icevision icon indicating copy to clipboard operation
icevision copied to clipboard

Compare performance of various mAP metrics

Open potipot opened this issue 4 years ago • 9 comments

🚀 Feature

Following the discussion from ice-dev it was suggested to compare different mAP metrics in terms of their performance. So far what we have available:

  • "default" COCOMetric
  • Frederik's mAP implementation
  • rafaelpadilla's project https://github.com/rafaelpadilla/review_object_detection_metrics
  • potentially mAP implemented by folks at pytorch-lightning https://github.com/PyTorchLightning/pytorch-lightning/pull/4564

potipot avatar Feb 25 '21 13:02 potipot

Quick observation: @fstroth and rafaelpadilla's project both use NumPy whereas the lightning implementation uses PyTorch. Curious how much of a speedup that would offer

rsomani95 avatar Feb 26 '21 09:02 rsomani95

use NumPy whereas the lightning implementation uses PyTorch.

Numpy would be better for us because eventually pytorch should become an optional dependency (we want to start offering tensorflow support). But I'm also curious to see the difference in speed.

lgvaz avatar Feb 26 '21 11:02 lgvaz

Hmm, is pytorch faster than numpy when running on CPU?

potipot avatar Feb 26 '21 11:02 potipot

Hmm, is pytorch faster than numpy when running on CPU?

It might be in some cases, but how much faster?

lgvaz avatar Feb 26 '21 11:02 lgvaz

Numpy would be better for us because eventually pytorch should become an optional dependency (we want to start offering tensorflow support)

Makes sense. Ambitious!

Not to crowd this space, but here's another NumPy implementation, from the author of Albumentations: https://github.com/ternaus/iglovikov_helper_functions/blob/master/iglovikov_helper_functions/metrics/map.py

rsomani95 avatar Feb 26 '21 12:02 rsomani95

If we want to go for maximum performance we should look into writing a version using numba.

fstroth avatar Feb 26 '21 12:02 fstroth

image Best way would be to see where we stand at, following the prof Knuth advice :D

potipot avatar Feb 26 '21 13:02 potipot

Not needed anymore.

FraPochetti avatar Dec 18 '21 16:12 FraPochetti

@FraPochetti I'd keep this one in the backlog.

This is exactly the reason why I got stuck working on custom metric implementation - results of mAP calculation for the same data all mutually differ on direct pycoctools, icevision+COCOMetric, and rafaelpadilla library.

potipot avatar Dec 19 '21 20:12 potipot