The goal of this project is to accurately identify starfish in real-time by building an object detection model trained on underwater videos of coral reefs.
Australia's stunningly beautiful Great Barrier Reef is the world’s largest coral reef and home to 1,500 species of fish, 400 species of corals, 130 species of sharks, rays, and a massive variety of other sea life.
Unfortunately, the reef is under threat, in part because of the overpopulation of one particular starfish – the coral-eating crown-of-thorns starfish (or COTS for short). Scientists, tourism operators, and reef managers established a large-scale intervention program to control COTS outbreaks to ecologically sustainable levels.
In this object detection project, we will be training a computer vision model YOLOv5. While there are a galaxy of models out there, I've chosen v5 to strut its stuff on my system's dance floor – it's like the ideal dance partner for my resources!
We will try to implement different computer vision techniques such as data augmentation, splitting the frame into multiple tiles, and a bunch of different preprocessing techniques. We will also perform Hyperparameter tuning to get much out of the model and get the best model for our problem statement.
- Small Object Problem
This refers to the difficulty of accurately detecting small objects compared to larger ones.
Fortunately, there are effective techniques available to mitigate this problem, one of which is the "Mosaic data augmentation" approach. This technique involves combining four images and dividing them into four randomly-sized tiles, allowing the model to learn from a more diverse range of object sizes and spatial arrangements.
In addition to mosaic data augmentation, there are several other methods and techniques that can be employed to address the small object problem. Some examples include adjusting anchor box sizes, implementing focal loss to focus on harder examples, using progressive resizing to train the model on larger image sizes, and incorporating object detection algorithms specifically designed for small objects, such as EfficientDet or YOLO Nano.
- Imbalance Dataset
Another challenge we face is the imbalance in the dataset due to a significant number of frames without starfish. To tackle this issue, we can selectively include only a subset of these empty frames for training, effectively reducing the class imbalance. However, this approach may result in a relatively small amount of training data.
To overcome the limited data concern, data augmentation techniques can be leveraged. These techniques involve applying various transformations such as rotation, scaling, translation, and flipping to artificially expand the training dataset. This augmentation increases the diversity of the available data and helps the model generalize better to unseen images.
By combining mosaic data augmentation, strategies to address the small object problem, and careful handling of imbalanced data through selective frame inclusion and data augmentation, we can enhance the performance and robustness of our starfish detection model.
The Data Augmentation Techniques can be performed manually, but as we are using YOLOv5, it will be handled by yolov5 itself.
Index | Weights | Epoch | Batch_size | Precision | Recall | mAP50 | mAP50:95 | Training Comment |
---|---|---|---|---|---|---|---|---|
1 | new | 30 | 16 | 0.928 | 0.839 | 0.904 | 0.492 | Simple Training |
2 | 1 | +40 | 16 | 0.91 | 0.86 | 0.92 | 0.49 | Added Mixup Augmentation |
2 | +30 | 16 | 0.946 | 0.846 | 0.918 | 0.508 | Default Hyp.yaml and Custom Augmented Data (Patches) | |
2_1 | +100 | 16 | 0.888 | 0.771 | 0.848 | 0.436 | Custom hyp.starfish.yaml : • Inc. 'box': '0.7' • Dec. 'cls': '0.1' • Dec. 'iou_t': '0.1' ----------- Added Mixup ----------- train data + custom augmented data |
|
2_1 | +100 | 16 | 0.91 | 0.908 | 0.939 | 0.556 | Default Hyp.yaml and train data + custom augmented data | |
3 | 2 | +10 | 16 | 0.905 | 0.805 | 0.895 | 0.475 | Custom hyp.starfish.yaml : • Inc. 'box': '0.5' • Dec. 'cls': '0.2' |
4 | 3 | +30 | 16 | 0.882 | 0.807 | 0.884 | 0.485 | Custom Data Augmentation (Patches) |
5 | new | 30 | 16 | 0.737 | 0.734 | 0.75 | 0.378 | Preprocessed Tiles Data (2x2) (simple Training) |
6 | 5 | +40 | 16 | 0.785 | 0.723 | 0.776 | 0.416 | Custom hyp.starfish.yaml : • Inc. 'box': '0.7' • Dec. 'cls': '0.1' • Dec. 'iou_t': '0.1' ----------- Added Mixup Augmentation |
7 | new | 30 | 16 | 0.846 | 0.67 | 0.758 | 0.345 | Preprocessed Tiles Data (3x2) w/ bbox_tile_threshold=0.5 (simple Training) |
8 | 7 | +40 | 16 | 0.774 | 0.694 | 0.758 | 0.395 | Custom hyp.starfish.yaml : • Inc. 'box': '0.7' • Dec. 'cls': '0.1' • Dec. 'iou_t': '0.1' ----------- Added Mixup Augmentation |
9 | 8 | +40 | 16 | 0.821 | 0.725 | 0.793 | 0.433 | Custom hyp.starfish.yaml : • Inc. 'box': '0.7' • Dec. 'cls': '0.1' • Dec. 'iou_t': '0.1' ----------- Added Mixup Augmentation |
Precision | Recall | mAP50 | mAP50:95 |
---|---|---|---|
0.91 | 0.908 | 0.939 | 0.556 |
The Data can be found here Tensorflow Great Barrier Reef
Check out the Notebooks:
I am open to any suggestions, connect with me anywhere!
Also, I would appreciate it if I could get a 🌟 for this repository from your side. ☺
I am a Data Scientist/Analyst and a Developer
Check out my GitHub profile for more details! See you on the other side :)