Cannot reproduce results given by torchvision.ops.nms

Hello,

I’m struggling to understand why results of torchvision.ops.nms differ so much when compared with some of the implementations that I’ve tried to recreate. I’m doing some sample projects in cpp and I need to code up NMS for object detection. In my PyTorch code I’m using torchvision.ops.nms, I’ve been trying to reimplement it in Python in the first place so that I can easily test my new code against my current one that is using torchvision.ops.nms. I’ve tried the following 3 implementations:

  1. Machine-Learning-Collection/nms.py at master · aladdinpersson/Machine-Learning-Collection · GitHub
  2. Non Maximum Suppression: Theory and Implementation in PyTorch
  3. Last one I’ve used (can’t paste the link as new user is limited to 2 links) was from PyTorch github, more specifically from pytorch/vision/torchvision/csrc/cpu/nms_cpu.cpp

As to my surprise, all 3 implementations give me exactly the same mAP results, however, none of them give me the same results as the one obtained from torchvision.ops.nms. Is this something that anyone noticed before, and if so, what would be the solution? I was hoping that the 3rd implementation which is literally a Python version of nms_cpu would solve it but to my surprise it didn’t.

Appreciate any feedback.

Cheers