# #8 Yolo and Faster R-CNN Ensemble

Summary
For object detection I'm using a weighted fusion ensemble of yolo11s and FasterRCNN. For the classification task I'm using logistic regression on BeIT embeddings of the pseudolabeled test dataset.
Object detection
Ensembling several models is always a good approach:
Yolo11s with training parameters (epochs=80, imgsz=640, batch=16, freeze=10, optimizer='AdamW', lr0=0.001667, momentum=0.9, warmup_epochs=6, warmup_momentum=0.5, box=10) and prediction parameters (iou=0.2, conf=1e-8, batch=16, augment=True). I used the very low value for conf because the competition metric doesn't punish submissions with lots of low-confidence false positives. The model detected 252600 objects.
FasterRCNN with horizontal flip for augmentation, pretrained weights FasterRCNN_MobileNet_V3_Large_FPN_Weights, num_epochs=30, batch_size=16, box_score_thresh=1e-8, learning rate=0.00125, some warmup, linear learning rate decay to a tenth of the starting value, and stochastic weight averaging. With the low box_score_thresh, the model detected 13802 objects.
Postprocessing:
For the four images which are duplicated between train and test, replace the models' predictions by the ground truth and set the confidence to 0.9999
As the models often detect two objects (partial shemaghs) where there should be only one, merge overlapping shemagh detections:
![merge1](assets/0ec08592c065086991864738.png)
![merge2](assets/1e60d1c1ad0cc16394c70c6e.png)
Weighted fusion ensemble of the two models
Classification
Pseudolabel the test dataset based on the yolo detections and a simple heuristic similar to what has been described by other competition participants
Embed the test images with BEiT
Classify the test dataset with logistic regression, tuning the threshold for maximum f1 in cross-validation. (As an alternative approach, an RBF kernel SVM could be used for classification with similar results).
Acknowledgment
I thank the organizers for preparing this interesting challenge,
[@hmnshudhmn24](https://www.kaggle.com/hmnshudhmn24)
for the yolo notebook and
[@asahli](https://www.kaggle.com/asahli)
for the weighted fusion ensemble notebook!