WongKinYiu / ScaledYOLOv4

Scaled-YOLOv4: Scaling Cross Stage Partial Network
GNU General Public License v3.0
2.02k stars 572 forks source link

NMS is slow #164

Open bobbilichandu opened 3 years ago

bobbilichandu commented 3 years ago

NMS is taking > 1 second. Is there anyway to make it fast?

LukeAI commented 3 years ago

do you have lots of false-positives?

bobbilichandu commented 3 years ago

No, I am using batchsize 4. For Batchsize 1, I get around 200ms. I implemented NMS previously using python and numba. It used to take only 3-5ms at max. Is there anyway to speedup NMS? Also, Can I used torchvision's batched_nms instead of enumerating and doing NMS for each batch individually?

bobbilichandu commented 3 years ago

@LukeAI I calculated times for each step. Apparently this particular is causing time lag. https://github.com/chandu1263/ScaledYOLOv4/blob/yolov4-large/utils/general.py#L588 Is there any reason why? Can I solve this? If so, how? Thanks in Advance.

WongKinYiu commented 3 years ago

I guess you meet this situation in early stage of training process. It due to https://github.com/WongKinYiu/ScaledYOLOv4/issues/164#issuecomment-773231029, there are too many predictions get high confidence score when model is not yet converged.

This situation usually will disappeared after several training epochs.