chengyangfu / retinamask

RetinaMask
MIT License
339 stars 52 forks source link

Why implement your own focal-loss #13

Closed txytju closed 5 years ago

txytju commented 5 years ago

❓ Questions and Help

I think focal loss can be written in pytorch, so why do you use your own? is it faster?

chengyangfu commented 5 years ago

Hi @txytju, For the detailed information, you can check this thread. I copy the table from there.

Experiment setting : PyTorch : v1.0.0 GPU : Pascal TitanX Model : retinanet_R-50-FPN_1x Batch size :2 for one GPU. Time and Memory are measured after 1000 iteration.

Implementation Time Memory
CUDA 0.3846 3443
PyTorch 0.4114 5298
JIT 0.4145 6661

In Conclusion, the difference between speed is minor, but the difference in memory consumption is huge. In the future, the JIT version could be faster and more efficient when PyTorch gets better. But the current version is not good yet for FocalLoss.

txytju commented 5 years ago

Great! Thanks for your explanation! And also thank you for your implementation of RetinaNet!

chengyangfu commented 5 years ago

I am closing this issue. Let me know if you have further questions.