WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.44k stars 4.23k forks source link

long objects is no where near to accurate detection but medium to small object detects perfectly #760

Open hassanaliemon opened 2 years ago

hassanaliemon commented 2 years ago

Hi, I am training yolov7 to detects objects and it detects small & medium objects accurately. But the problem arises when long objects come, it performs poor in single long objects (along with small & medium objects). However, when several long objects are situated closely, model is no where near to accurate detection.

Previously it was not detecting long objects at all, then I turned augment to false. Now, it detects long objects but performance is very poor.

What can be the problem? Thanks for this amazing repo :)

WongKinYiu commented 2 years ago

When the height-width-ratio of object is larger than 4x height-width-ratio of anchor, the object will never get positive samples for training. For this case, you have to add more anchors to fit the long objects.

akashAD98 commented 2 years ago

@WongKinYiu @AlexeyAB how can we add anchor? is there any method like alexyab darknet has ? in which we calculate our custom anchor based on the dataset?

hassanaliemon commented 2 years ago

@akashAD98 you can use google to get some scripts that will help you to get your anchors, however when you are working with your won data I think it will just come to you with time.

@WongKinYiu thanks for the reply. I visualized the targets and after changing anchors no target is missing now. However, I am getting that long/big object problem still! I have come to conclusion that Small object detection is excellent but medium to long/big objects are very poor in detection.

As I have told, I have visualized targets right before it calculates loss and right after 'targets' variable comes from 'self.build_targets' function. Is there anything I am missing?

akashAD98 commented 2 years ago

@hassanaliemon it would be great if you can do this script as open source for community

holger-prause commented 2 years ago

Solved by https://github.com/WongKinYiu/yolov7/issues/617#issuecomment-1309363633