weecology / DeepForest

Python Package for Airborne RGB machine learning
https://deepforest.readthedocs.io/
MIT License
511 stars 172 forks source link

square elongation for cropmodel #820

Open bw4sz opened 5 days ago

bw4sz commented 5 days ago

From an unpublished paper, which I can later link.

Instead of cropping tightly around the object, we convert the bounding boxes into square shapes by extending the shorter side to match the length of the longer side. Another way to think of it is that we are doing padding with natural pixels. Our box expansion approach maintains the original aspect ratios of objects without introducing artifacts, reducing the likelihood of misidentification.

We could do this for the cropmodel workflow.

The relevant code is here:

https://github.com/weecology/DeepForest/blob/8815d4b89e6e482c46bff7ed7d574efb44052432/deepforest/model.py#L161

ethanwhite commented 5 days ago

This is a really cool idea!

NaganathanM commented 4 days ago

Hi! If my understanding is correct, you want to adjust the xmin, xmax or ymin, ymax depending on the longer side, to make the box square. Shall I take up and work on this if it's still open?

bw4sz commented 4 days ago

For sure, let me know if you need help.