# Few lessons learned (4th place)

Thanks to all who has been a part of this competition - our second segmentation story in a row and finally gold for me and
[@ddanevskyi](/ddanevskyi)
,
[@vshmyhlo](/vshmyhlo)
. We hadn't stopped training our model till the last hour and that's a nice story about how we stuck around top-30 on public but kept challenging and improving our models till the end.
Data science is more about understanding the task and therefore making proper validation. Keep calm watching public leaderboard - 12% of highly unbalanced dataset makes no real view. The story was not only about detecting ships but more to fight false positives (wave glare etc). We found having a good ship/no-ship classifier to be much more important for this competition than having a very good performing segmentation model. That's not hard part to obtain.
About validation not much to say - folds based on this shinny
[kernel](https://www.kaggle.com/manuscrits/create-a-validation-dataset-correcting-the-leak/notebook#x)
(cheers
[@manuscrits](/manuscrits)
!). Clear,  no leaks, evaluated on ship images only with a small amount of no-ship images added (around 9k images totally). We got all kinds of U-Nets tuned from TGS Competition so we trained separately shallow/deep encoders to blend 4 of them as a final model. We made a really nice grid search over U-Net based architectures.
Few words about lessons learned:
Check your U-Net concatenations - if you want to predict small objects then try to avoid poolings/strides>1 where they can be avoided. Also size matters - we found that missing central unet layer (< x / 32) leaded to worst predictions of huge ships (up to 300px length).
Deep networks not always lead to better results unless you tune and train them forever. Pick the best encoder to fit your particular resources, unet architecture, finetuning etc. Our best validation model was resnet34 (oh yes) trained 300 +epochs on cropped images.
Finetuning on the full size images might boost you performance significantly if tuned properly (from 0.490 to 0.520 local-ships only validation as example).
Part of success was an accurate intelligent 256 cropping.
Some of losses lead to better shapes of boats but force ships to be more homogeneous which makes them hard to split. BCE-based will gave you worse shapes but more chances to split em.
Also there are more to say about what additional channels might help you to fit instance segmentation, to split ships but we didn't achieve our best - unfortunately we didn't finalize our solutions for boundaries predictions (due to dice based loss probably). Looking forward to read about that from other teams.
Thanks my talented team. Thanks the best community
[ods.ai](http://ods.ai)
for a wonderful sense of humor!