PyTorch_YOLOv4 icon indicating copy to clipboard operation
PyTorch_YOLOv4 copied to clipboard

Can you please also include the results of speed vs mAP accuracy and compare it with original YOLOv4 implementation? The current results only include mAP accuracy.

Open BipinJG opened this issue 5 years ago • 18 comments

BipinJG avatar Jul 17 '20 23:07 BipinJG

Hello, do you mean compare the speed on darknet and pytorch?

WongKinYiu avatar Jul 19 '20 03:07 WongKinYiu

Great work @WongKinYiu . Glad to see you make this repo (I had been following your discussion with Alexey when you were doing all your comparisons between your and his V4 work and the Ultralytics "v5" release).

I suspect the OP is asking at the very least about fps info when these networks are run in the native Pytorch implementation in this repo on whatever GPU you are using. I am also curious to see those numbers as a part of your table in the Readme.

Cheers

HamsterHuey avatar Jul 20 '20 01:07 HamsterHuey

Hello, do you mean compare the speed on darknet and pytorch?

@WongKinYiu Yes. I was just curious about the speed and mAP comparison of original darknet implementation by AlexeyAB vs your pytorch implementation.

BipinJG avatar Jul 21 '20 22:07 BipinJG

If use Leaky activation function, Pytorch gets about 5 FPS slower than Darknet when input size is 608x608. If use Mish activation function, Pytorch gets about 30% slower than Darknet.

WongKinYiu avatar Jul 21 '20 23:07 WongKinYiu

@WongKinYiu - Is that difference in speed primarily because those activation functions are in Python and not custom C / CUDA implementations compared to darknet implementations?

HamsterHuey avatar Jul 22 '20 13:07 HamsterHuey

@WongKinYiu why not use this - https://github.com/thomasbrandon/mish-cuda for PyTorch

digantamisra98 avatar Jul 22 '20 20:07 digantamisra98

@digantamisra98

thanks, i will take a look it.

WongKinYiu avatar Jul 22 '20 23:07 WongKinYiu

@digantamisra98

thanks, now it almost as fast as leaky model (+6~10% inference time).

before:

Speed: 6.7/1.0/7.7 ms inference/NMS/total per 736x736 image at batch-size 8

after:

 Speed: 5.3/0.9/6.1 ms inference/NMS/total per 736x736 image at batch-size 8

AP drops a little bit, maybe I will re-train the model with this mish implementation.

WongKinYiu avatar Jul 23 '20 07:07 WongKinYiu

Great, what's the precision you're using (fp32/fp16)? Also, what's the drop in AP? Usually the faster implementation mirrors the learning performance as that of the original non optimized version.

digantamisra98 avatar Jul 23 '20 11:07 digantamisra98

@digantamisra98

I use fp16, and it drops ~0.01% AP.

WongKinYiu avatar Jul 23 '20 12:07 WongKinYiu

I don't think that's a significant level of drop. So you basically changed old Mish to this new version in the inference only with the already trained model on old Mish?

digantamisra98 avatar Jul 23 '20 12:07 digantamisra98

yes, just use new Mish to replace old Mish.

from mish_cuda import MishCuda as Mish

WongKinYiu avatar Jul 23 '20 13:07 WongKinYiu

@WongKinYiu - Do you have an idea or guess on where the performance is dropping between the Darknet implementation and the Pytorch implementation? Usually in the past, I have seen that similar models in Pytorch were a bit faster than their Darknet counterpart. I haven't kept up with the darknet repo development but I was curious about where this performance difference may be coming from.

HamsterHuey avatar Jul 23 '20 14:07 HamsterHuey

cudnn api.

WongKinYiu avatar Jul 23 '20 14:07 WongKinYiu

@WongKinYiu Thanks for the great work. Just tested Alexey original darknet implementation, and it seems to have a much higher mAP. Any idea why?

edwin323 avatar Jul 31 '20 19:07 edwin323

original yolov4 is trained on coco2014 setting, val5k of coco17 has some overlap with train of coco2014. if you want to compare the mAP, please use test-dev set.

WongKinYiu avatar Jul 31 '20 22:07 WongKinYiu

@digantamisra98 hello, i update results of mish models, you could find them in readme.

WongKinYiu avatar Sep 10 '21 03:09 WongKinYiu

Thank you, checking it out now!

digantamisra98 avatar Sep 10 '21 03:09 digantamisra98