Week 2 (Jun 09 - Jun 15)
Meeting with Mentors
We discussed about the progress made in the previous week where I have refactored dataset and model classes. I also raised an issue I encountered during testing: in one of the examples, the inference output appeared distorted compared to earlier results. David mentioned he would look into it on his end(which was fixed later that week through Issue #314).
Another topic was the current file structure. Right now, both the dataset
and model
directories have a lot of files, and David suggested we may consider restructuring them later as the project evolves. Overall, the feedback from mentors was positive, and we moved ahead with planning goals for the coming week.
This Week’s To-Do
- Add support for COCO dataset
- Add support for Torch detection models (Partially done)
- Explore Streamlit if time permits
Progress
COCO Dataset Support
- I started by creating
coco.py
, which includes aCocoDataset
class derived fromImageDetectionDataset
. - I was spending some time to check if I should use pycocotools or write our own parsing logic. Some GitHub issues pointed out that the official
pycocotools
is not Windows-friendly. - We found a workaround using
pycocotools-windows
for Windows machines. After discussing with mentors, we decided to handle installation conditionally. David also confirmed by installing the library in his windows machine. I have handled the installation in pyproject.toml like shown in the code below using this snippet:
pycocotools = { version = "^2.0.7", markers = "sys_platform != 'win32'" } pycocotools-windows = { version = "^2.0.0.2", markers = "sys_platform == 'win32'" }
- Within the
CocoDataset
class:- _build_ontology() maps COCO category IDs to the framework’s format.
- _build_dataframe() prepares the structure used by the base class.
- read_annotation() processes annotations for each image based on image_id.
Torch Model Refactor
- I renamed
torch.py
totorch_segmentation.py
and updated the imports across all example scripts accordingly. - Then I created
torch_detection.py
to support detection models. - Taking
torch_segmentation.py
as a reference, I modified:- data_to_device()
- get_data_shape()
- get_computational_cost()
to account for the different input format used in detection:
List[Dict[str, Tensor]]
. - I wasn’t sure if unsqueeze_data() and the CustomResize class were necessary for detection, so I skipped them for now.
- I was unwell on Tuesday and Wednesday and couldn’t make as much progress as I had planned. I couldn’t fully finish torch_detection.py this week. However, I’ve committed the partial changes in the draft PR #312.
Going ahead
Next week, I’ll aim to:
- Complete the Torch detection model integration
- Add the metrics evaluation part for detection
- Add an end-to-end example with COCO + Torch detection
Enjoy Reading This Article?
Here are some more articles you might like to read next: