Image Detection & Recognition (Brainhack 2022)
Trained and refined image detection and recognition models for the Brainhack 2022 competition.
- Python
- PyTorch
- NumPy
Competed in Brainhack 2022 (May–Jul 2022) as a developing member, training and refining image detection and recognition models with PyTorch and NumPy across multiple datasets.
Object detection with Faster R-CNN
One of the models takes an image and returns a box around each object it finds, with a label and a confidence score. The team's own images came with annotations in the COCO format: a bounding box and a category for each object, one category being "fallen".
- Transfer learning: training starts from a Faster R-CNN model (a ResNet-50 backbone with a feature pyramid network) already trained on the large COCO dataset, and only its final classification layer is replaced, which suits a small dataset.
- A custom PyTorch dataset reads the annotations with pycocotools and converts each box from [x, y, width, height] to the corner coordinates the model expects.
- Training images are randomly flipped left to right, together with their boxes, so the model sees more variety from the same data.
- The model is trained with stochastic gradient descent, lowering the learning rate tenfold every three epochs; some images are held back for testing.
- Results are scored with the COCO metrics, which measure how much each predicted box overlaps the true one (intersection over union), and predictions are drawn on test images to check them by eye.
Tools
Python, PyTorch and TorchVision, NumPy and pycocotools, in a Deepnote notebook, adapting TorchVision's object-detection fine-tuning recipe to the team's own data.