Yet-Another-EfficientDet-Pytorch icon indicating copy to clipboard operation
Yet-Another-EfficientDet-Pytorch copied to clipboard

Can't detect small objects even though scales set to very small

Open lucasjinreal opened this issue 5 years ago • 20 comments

I tried these scales and ratios on my dataset:

# this is coco anchors, change it if necessary
# anchors_scales: '[2 ** 0, 2 ** (1.0 / 3.0), 2 ** (2.0 / 3.0)]'
# anchors_ratios: '[(1.0, 1.0), (1.4, 0.7), (0.7, 1.4)]'
anchors_scales: '[0.02, 0.6, 2 ** (1.0 / 3.0)]'
anchors_ratios: '[(1.0, 1.0), (1.4, 0.7), (0.7, 1.4)]'

the scales is small enough, however the detection result is always miss every small objects.

the bigger one can detect every well. Did I missed anything? How to generate anchor more properly?

lucasjinreal avatar Apr 24 '20 08:04 lucasjinreal

is it a typo? Doesn't 0.02 means that the smallest anchor size is only 0.64?

zylo117 avatar Apr 24 '20 10:04 zylo117

I am just did some experiments, what's your mean by anchor size is 0.64? How's that value out and in pixel? Or according to featuremap size? I am indeed don't know how to design these scales, say if I want minimal pixel size 8 on image, which minimal scale should I use? If image size is 1960x1080

lucasjinreal avatar Apr 24 '20 12:04 lucasjinreal

By default, there are 45 anchors combinations. 3 scales, 3 ratios, 5 pyramid level(from 2^3 to 2^7). And there is also a base scale, which is 4, except for D7 which is 5. For your case, the smallest anchor size is, scale 0.02 * ratio 1.0 * pyramid_level 2^3 * base_scale 4 = 0.64. It doesn't care about your image size.

zylo117 avatar Apr 24 '20 16:04 zylo117

@zylo117 thanks for your clarification. so does 0.64 cover minimal pixel size 8 pixel target on my image? By how? From experiments shows, the tiny objects even with pixel > 32 can not be detected. How to set scales to make it detect?

lucasjinreal avatar Apr 25 '20 03:04 lucasjinreal

anchor size 0.64 means 0.64 pixels, which is too small. you can list out all 45 anchors to see if they closely match most of the gt boxes. It's hard to regress if they don't.

zylo117 avatar Apr 25 '20 05:04 zylo117

ok, let me try 0.25

lucasjinreal avatar Apr 25 '20 07:04 lucasjinreal

ok, let me try 0.25

@jinfagang Did you successfully improve your performance by doing what you listed above?

Cli98 avatar May 27 '20 06:05 Cli98

No, I tried your tool and dedicatedly design my anchor, result also not full satisfying although it seems work but have a lots of missdetections.

lucasjinreal avatar May 27 '20 06:05 lucasjinreal

No, I tried your tool and dedicatedly design my anchor, result also not full satisfying although it seems work but have a lots of missdetections.

@jinfagang I see. I will double check my code. Thx for your feedback. In the meanwhile, I have to admit that I'm stilling wondering possible way to improve my AP for this repo.

Cli98 avatar May 27 '20 08:05 Cli98

@Cli98 Did u found noticeable miss detection when you inference in video images?

lucasjinreal avatar May 28 '20 02:05 lucasjinreal

@Cli98 Did u found noticeable miss detection when you inference in video images?

@jinfagang No. I checked image detection only. Raise AP by 2 points with my anchors. But it's on mmdetection, not this repo.

Cli98 avatar May 28 '20 03:05 Cli98

@Cli98 with which model?

lucasjinreal avatar May 28 '20 05:05 lucasjinreal

@Cli98 with which model?

@jinfagang Not efficientdet but faster rcnn fpn r50 1x. You can check configuration file in ./configs

Cli98 avatar May 28 '20 06:05 Cli98

how's the performance in compare with fasterrcnn fpn and efficientdet Dx?

lucasjinreal avatar May 28 '20 07:05 lucasjinreal

how's the performance in compare with fasterrcnn fpn and efficientdet Dx?

@jinfagang ~6 points better than this repo.

Cli98 avatar May 28 '20 08:05 Cli98

@Cli98 You will get same result as mine if you visualize your result. I am detecting images on video frame by frame, it noticable not stale in detect. (side by side 2 frames mgith have target miss detection on the first one via detected in second one), Also score is not stable as well, small offset frame side by side, first one may be 0.9 then next one maybe 0.1.

I believe these problems is commonly in one stage detectors.

lucasjinreal avatar May 28 '20 08:05 lucasjinreal

@Cli98 You will get same result as mine if you visualize your result. I am detecting images on video frame by frame, it noticable not stale in detect. (side by side 2 frames mgith have target miss detection on the first one via detected in second one), Also score is not stable as well, small offset frame side by side, first one may be 0.9 then next one maybe 0.1.

I believe these problems is commonly in one stage detectors.

@jinfagang That's quite weird. You run inference in an on-line manner? If all in same size, there should not be such difference I guess. Will performance improve if you train more epochs (the detector is not stable at all, maybe due to underfit)? By the way, are you doing video object detection or object tracking?

BTW Already 1 a.m. est now. Are you working overnight? I have never heard anyone from google works overnight lol.

Cli98 avatar May 28 '20 08:05 Cli98

@Cli98 not temporal model, just frame by frame detection. I am in China now.

lucasjinreal avatar May 28 '20 08:05 lucasjinreal

@jinfagang Hi, I am just wondering if you get any good results with the updated anchor scales and ratios because I am working on a small obj detected with less than 0.06 of its image? any advice? or optimal values for tiny objects

alsheabi avatar Dec 22 '21 00:12 alsheabi

I'm also looking for a solution to this problem in this repo. Small objects are completely ignored for me, so far.

dav-ell avatar Jan 31 '22 22:01 dav-ell