icevision
icevision copied to clipboard
Introduce mosaic augmentation
Fixes #587
- [x] figure out how to attach mosaic as batch_tfms
- [x] implement bbox unaware mosaic
- [x] implement bbox safe crop mosaic with scaling
- [ ] implement bbox safe crop without scaling (requires new Albumentation transform)
- [ ] add tests (especially for negative samples - what happens if there is no bbox to "safely crop"?)
some early results for bbox unaware mosaic
Codecov Report
Merging #1007 (e4b74db) into master (4050e0e) will decrease coverage by
0.28%
. The diff coverage is54.00%
.
:exclamation: Current head e4b74db differs from pull request most recent head b7e64f1. Consider uploading reports for the commit b7e64f1 to get more accurate results
@@ Coverage Diff @@
## master #1007 +/- ##
==========================================
- Coverage 85.88% 85.59% -0.29%
==========================================
Files 255 256 +1
Lines 5631 5679 +48
==========================================
+ Hits 4836 4861 +25
- Misses 795 818 +23
Flag | Coverage Δ | |
---|---|---|
unittests | 85.59% <54.00%> (-0.29%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
icevision/tfms/batch/mosaic.py | 48.88% <48.88%> (ø) |
|
icevision/data/record_collection.py | 100.00% <100.00%> (ø) |
|
...sion/tfms/albumentations/albumentations_adapter.py | 96.25% <100.00%> (ø) |
|
icevision/tfms/batch/__init__.py | 100.00% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
bbox aware mosaic with enforced scaling
what I want to achieve with non-scaling mosaic is keeping the original size of objects. The current scaled mosaic tries to encircle all of the bboxes in an image and make such crop, that will include all of the objects.
Another, smarter approach is to select exclusive areas in an image that can be cropped out and used as "pieces" in the mosaic.
Can this be merged? It looks fantastic, and I've been struggling trying to implement one myself.
@dav-ell Oh wow! I completely forgot about this one. Yeah I'll sync master changes and try to merge it as is. (the non-scaling mosaic aug is still TBD but if you find it useful as is then I'd say let's merge!)
Thanks @potipot!
What a shame that I just finished my own custom implementation that I referenced here: https://github.com/albumentations-team/albumentations/issues/677#issuecomment-1068088671
The good news is that this one has more features than mine, so I'll almost definitely be switching over once it's in.
This looks great. I am also looking for a similar functionality for object detection. I hope it can be merged soon =)
Any update on this?
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
Hi @mikel-brostrom, it's been a while since I worked on this. I just checked and it should be working. Do you mind giving it a try? you can install this PR in your venv by
pip install git+https://github.com/potipot/icevision@add_mosaic#egg=icevision[all]
here is the notebook showcasing how to use the mosaic tfm: https://github.com/potipot/icevision/blob/add_mosaic/notebooks/mosaic.ipynb
if it works for you I could put some more time into it and try to merge it.