AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.66k stars 7.96k forks source link

calc_anchors on a test set #2226

Open NEELMCW opened 5 years ago

NEELMCW commented 5 years ago

Hello @AlexeyAB

Does it make sense to run calc_anchors against the target test set at hand and compare the anchor sizes to conclude that the test set chosen is nearly similar to train set used

Do these have to agree on the anchor centers ideally ?

AlexeyAB commented 5 years ago

@NEELMCW Hi,

Yes, I do it sometimes, to compare Training and Test sets.

Do these have to agree on the anchor centers ideally ?

In general approximately yes.


This is a necessary but not sufficient condition, because it doesn't take class_id into account. For example, in the Training dataset there are obj1 with relative size 90% x 90% and obj2 with relative size 10% x 10%, but in the Test dataset vice versa obj1 10% x 10% and obj2 90% x 90%. So you will see that both datasets have ~the same size 10% - 90%, but trained model couldn't detect objects from test dataset.

NEELMCW commented 5 years ago

@AlexeyAB

Does that mean the learnt model can only detect the class_id sizes that it was fed with during training

aren't there size based augmentations that would take care of learning different relative sizes ?

The yolo trained and learnt solution will have to generalize well for obj1 of any size right ? As long as obj 1 is fed during training

AlexeyAB commented 5 years ago

@NEELMCW

Every modern convolutional neural network can detect class_id sizes that it was fed with during training.

Data augmentation partially helps to solve it by resizing objects [0.5x - 4x] if is used random=1 and jitter=0.3

NEELMCW commented 5 years ago

@AlexeyAB Great. What should be the number of objects per class I should have for the test set ?

Any comments you wish to add on the size of these objects . In coco challenge I see the evaluation metrics considering the bounding box areas. such as follows

a. Area < 1024 b. Area between 1024 and 9216 c. Area above 9216

to categorize perhaps small medium and large objects

Whats your opinion ?

AlexeyAB commented 5 years ago

What should be the number of objects per class I should have for the test set ?

What do you mean? Should be 2000 images per class_id.

a. Area < 1024 b. Area between 1024 and 9216 c. Area above 9216

to categorize perhaps small medium and large objects

Whats your opinion ?

Yes, there are different AP (small, medium, large) for different object sizes, to get the best DNN for required sizes of objects: http://cocodataset.org/#detection-leaderboard