Hi,
Thanks a lot to the organizers, sponsors and AICrowd team for this quite interesting challenge!
My solution that reached 3rd place on both public and private LB is based on two stages:
- Stage1: A mosquito bounding boxes detector model based on Yolo.
- Stage2: An ensemble of two mosquito classifiers models. First model is based on ViT architecture and second on EfficientNetv2 architecture.
The two main challenges in this competition were the 2 seconds CPU per image runtime limit and the high imbalance for rare classes in the training dataset. Such constraints limit the total number of models we could ensemble, TTA options, image size and size of the possible models.
After several experiments, my conclusion was that a single model “on the shelf” that could do both bounding boxes + classification won’t perform as good as two dedicated separate models. For bounding boxes I’ve ensembled 4 YoloV8 nano models (converted to OpenVino to speed up inference) trained on a single class. For mosquitos I’ve trained two classifiers with different architectures and image size. I got some boost/stability on classification score with the following items in the training procedure:
- Hard augmentations including Mixup + CutMix
- Averaging weights with EMA
- Label smoothing
- Creating a 7th class (no mosquito) with background images generated from training images without mosquito. I believe that blood + fingers was prone to confuse the model.
- External data that brings more examples on rare classes. I’ve only used a limited subset of what was provided in the external datasets thread because I find it quite noisy.
Cross validation for each model single was F1=0.870/0.860 (best fold with 0.891). However, it was not possible to use them in inference due to time limit. So, I’ve decided to train a full fit model to benefit from all data in a single model. Basic ensembling of both classifiers (no TTA) reached 0.904 on public LB and 0.915 on private LB.
What did not work (or not improve):
- Increasing image size to 1024x1024 does not bring more information to the models
- Forcing the aspect ratio to 1.0 on resize did not help
- Single stage 6 classes Yolo model (both regular and RTDETR)
- Single stage 6 classes EfficientDet model
- SWA (last 5 epochs or best 5)
- Model pruning (to speed up inference)
- Post Processing: Add/remove margin to predicted BB
- Training based on mosquito bodies only. I’ve created a mosquito body extractor but my conclusion is that relying on head, thorax, and dorsal is not enough. We have predictive power in mosquito legs and wings. It might be obvious for the experts but from past experiences on other species it was worth trying.
Cheers.
