`nms` and `batched_nms` are not working properly for predictions made by pretrained `ssd300_vgg16`

Amit_Sur: <p>I am trying to make some predictions using <code>torchvision.models.detection.ssd300_vgg16</code> without any modification to the model using the following code:</p>
<pre><code class="lang-auto">model = torchvision.models.detection.ssd300_vgg16(weights="DEFAULT")

img1 = decode_image("./sample1.jpeg")
img1 = F.to_image(img1)
img1 = F.to_dtype(img1, torch.float32, True)
img1 = img1.unsqueeze(0)


model.eval()
with torch.inference_mode():
    preds1 = model(img1)
</code></pre>
<p>Every time the model is predicting 200 bounding boxes along with their scores and labels and then I am trying to perform NMS on the boxes using <code>batched_nms</code> like <code>batched_nms(preds1[0]['boxes'], preds1[0]['scores'], preds1[0]['labels'], 0.3)</code>. I have tried with different <code>iou_threshold</code> values. But every time, I am getting the same set of box indices, in the same order.</p>
<p>The prediction looks like:</p>
<pre><code class="lang-auto">[{'boxes': tensor([[2.6423e+00, 1.1119e+00, 1.4088e+02, 1.0790e+02],
          [1.4234e+02, 1.3731e+01, 3.1756e+02, 1.2449e+02],
          [3.1312e+02, 1.0990e+02, 3.6322e+02, 1.2568e+02],
          [1.5407e+02, 1.3470e+01, 2.9520e+02, 1.1361e+02],
          [5.1814e+01, 5.7662e+01, 9.3609e+01, 1.1536e+02],
          [1.4954e+02, 9.7680e+01, 3.0812e+02, 1.2332e+02],
          [1.8946e+02, 6.8504e+01, 2.0621e+02, 7.6443e+01],
          [1.6102e+02, 1.0283e+02, 2.9985e+02, 1.1376e+02],
          [3.1395e+02, 1.0930e+02, 3.6296e+02, 1.2437e+02],
          [9.2524e+01, 4.7876e+01, 1.1974e+02, 1.0735e+02],
          [2.8712e+01, 2.4591e+01, 1.0642e+02, 1.1274e+02],
          [1.6768e+01, 5.2113e+01, 4.5838e+01, 1.0066e+02],
          [2.7575e+02, 5.3727e+01, 2.8296e+02, 6.2764e+01],
          [5.6533e+00, 7.5455e+01, 2.7523e+02, 1.3467e+02],
          [1.6096e+02, 7.8855e+01, 1.8039e+02, 9.3152e+01],
          [4.0746e+01, 6.1006e+01, 6.5967e+01, 1.0846e+02],
          [2.6609e+02, 5.2819e+01, 2.7283e+02, 6.2838e+01],
          [1.6698e+02, 9.5016e+01, 2.9775e+02, 1.0568e+02],
          [1.9903e+02, 6.7810e+01, 2.0761e+02, 7.1792e+01],
          [0.0000e+00, 2.1697e+01, 5.9806e+01, 1.0582e+02],
          [2.8311e+02, 5.2543e+01, 2.8958e+02, 6.2547e+01],
          [1.9551e+02, 6.9180e+01, 2.0446e+02, 7.3864e+01],
          [1.2936e+02, 1.0790e+02, 3.2241e+02, 1.3237e+02],
          [5.6326e+00, 1.5006e+01, 6.2715e+01, 6.0456e+01],
          [2.6570e+02, 5.0473e+01, 2.7199e+02, 5.8998e+01],
          [1.6149e+02, 4.4755e+00, 2.7209e+02, 5.0777e+01],
          [1.5572e+02, 7.5301e+01, 1.6969e+02, 9.0721e+01],
          [2.4006e+01, 8.4151e+01, 1.6247e+02, 1.3754e+02],
          [2.0456e+02, 1.2615e+01, 2.9299e+02, 8.3519e+01],
          [1.5436e+02, 6.6860e+01, 3.0996e+02, 1.2060e+02],
          [1.7146e+02, 7.9810e+01, 1.8802e+02, 9.2409e+01],
          [4.0386e+00, 0.0000e+00, 7.9031e+01, 3.9515e+01],
          [4.7828e+01, 0.0000e+00, 1.2814e+02, 3.7504e+01],
          [1.6466e+02, 7.2240e+01, 1.7796e+02, 8.5629e+01],
          [1.8713e+02, 6.8843e+01, 1.9797e+02, 7.7056e+01],
          [1.7648e+02, 6.6352e+01, 2.0751e+02, 7.8344e+01],
          [2.6939e+02, 5.4035e+01, 2.7618e+02, 6.0825e+01],
          [2.0540e+02, 6.5939e+01, 2.1539e+02, 7.1103e+01],
          [2.1571e+02, 7.4219e+01, 2.2574e+02, 8.4874e+01],
          [1.7558e+02, 6.8570e+01, 1.8801e+02, 7.6675e+01],
          [2.0385e+02, 6.6965e+01, 2.1171e+02, 7.0526e+01],
          [1.5690e+02, 7.4848e+01, 1.8785e+02, 9.1346e+01],
          [8.0378e+00, 3.7644e+01, 6.4056e+01, 7.5411e+01],
          [1.9516e+02, 8.1881e+01, 2.0683e+02, 9.1658e+01],
          [1.1326e+01, 0.0000e+00, 1.6492e+02, 2.4082e+01],
          [2.5685e+02, 5.1411e+01, 2.6310e+02, 5.7939e+01],
          [5.3724e+01, 8.3323e+01, 8.7975e+01, 1.1918e+02],
          [9.4711e+01, 1.0987e+01, 1.5922e+02, 1.0450e+02],
          [2.2144e+02, 6.8274e+01, 2.3410e+02, 8.2114e+01],
          [2.1776e+02, 7.0287e+01, 2.2761e+02, 8.1509e+01],
          [3.1312e+02, 1.0990e+02, 3.6322e+02, 1.2568e+02],
          [1.2989e+02, 1.0998e+01, 2.4872e+02, 6.6501e+01],
          [1.8231e+02, 8.0795e+01, 1.9828e+02, 9.2042e+01],
          [9.9216e+00, 3.7309e+00, 5.0551e+01, 4.6989e+01],
          [2.5559e+02, 5.3663e+01, 2.6368e+02, 6.2541e+01],
          [2.1270e+02, 7.7440e+01, 2.2413e+02, 8.8609e+01],
          [2.7363e+02, 5.4800e+01, 2.8021e+02, 5.9651e+01],
          [2.7592e+02, 5.0953e+01, 2.8504e+02, 5.7419e+01],
          [2.8321e+02, 5.1097e+01, 2.9062e+02, 5.7183e+01],
          [2.0390e+02, 7.4988e+01, 2.1739e+02, 8.5327e+01],
          [1.8055e+02, 6.9500e+01, 1.9191e+02, 7.5034e+01],
          [2.0496e+02, 7.9606e+01, 2.1793e+02, 8.8764e+01],
          [2.5758e+02, 4.9917e+01, 2.6256e+02, 5.4716e+01],
          [1.8762e+02, 6.8342e+01, 1.9476e+02, 7.3417e+01],
          [2.2994e+02, 5.2400e+01, 2.6501e+02, 6.9270e+01],
          [2.7828e+02, 5.4248e+01, 2.8614e+02, 5.9867e+01],
          [5.2229e+01, 6.0402e+01, 9.2659e+01, 7.9832e+01],
          [2.6604e+02, 4.8401e+01, 2.7211e+02, 5.5008e+01],
          [2.6486e+02, 5.5995e+01, 2.7371e+02, 6.5199e+01],
          [1.9017e+02, 6.7889e+01, 1.9681e+02, 7.1705e+01],
          [7.4846e+01, 0.0000e+00, 1.7115e+02, 4.8195e+01],
          [2.5217e+02, 6.1301e+01, 2.6309e+02, 7.6891e+01],
          [1.7225e+02, 7.2430e+01, 1.8686e+02, 8.4560e+01],
          [1.1545e+02, 4.5936e+01, 1.4088e+02, 1.0413e+02],
          [1.4233e+02, 1.4999e+01, 2.1424e+02, 1.0523e+02],
          [1.5429e+02, 8.2358e+01, 1.6918e+02, 9.6977e+01],
          [2.0246e+02, 6.8075e+01, 2.1512e+02, 7.4917e+01],
          [1.5517e+02, 8.0980e+01, 1.8880e+02, 9.7486e+01],
          [1.8050e+01, 2.7759e+01, 9.2874e+01, 6.9015e+01],
          [2.0488e+02, 7.0929e+01, 2.1570e+02, 8.0403e+01],
          [5.5187e+01, 6.6440e+00, 8.2817e+01, 4.4714e+01],
          [1.8422e+02, 7.3693e+01, 1.9677e+02, 8.4632e+01],
          [6.9483e+01, 1.5783e+01, 1.0222e+02, 5.6037e+01],
          [2.9104e+01, 6.2486e+00, 6.4815e+01, 4.4664e+01],
          [8.9995e+01, 1.3989e+01, 1.2544e+02, 5.5316e+01],
          [1.9404e+02, 7.4222e+01, 2.0619e+02, 8.4465e+01],
          [1.6659e+02, 6.4830e+01, 1.9646e+02, 7.9078e+01],
          [2.7576e+02, 4.9600e+01, 2.8150e+02, 5.4584e+01],
          [5.5943e+01, 2.2736e+01, 8.6231e+01, 6.6206e+01],
          [2.2579e+01, 5.0093e+00, 1.0554e+02, 4.8159e+01],
          [1.5345e+02, 1.1474e+02, 3.0120e+02, 1.2612e+02],
          [1.9926e+02, 6.7221e+01, 2.0419e+02, 6.9793e+01],
          [2.0322e+01, 4.2030e+01, 9.8928e+01, 8.3228e+01],
          [1.7009e+02, 8.5246e+01, 1.9177e+02, 9.4258e+01],
          [1.7198e+02, 7.0920e+01, 1.8680e+02, 7.8649e+01],
          [2.0835e+02, 6.5283e+01, 2.1526e+02, 6.8491e+01],
          [1.9492e+02, 6.7442e+01, 2.0098e+02, 7.0582e+01],
          [2.8402e+02, 5.4530e+01, 2.9157e+02, 5.9483e+01],
          [7.0340e+01, 2.4801e+01, 1.4502e+02, 6.8013e+01],
          [6.7327e+01, 5.3775e+01, 9.8495e+01, 9.5229e+01],
          [1.7197e+02, 8.5610e+01, 2.8972e+02, 1.1279e+02],
          [4.8561e+01, 1.1223e+02, 3.5378e+02, 1.3800e+02],
          [2.0639e+02, 8.3774e+01, 2.1963e+02, 9.0568e+01],
          [2.5376e+02, 5.6180e+01, 2.6370e+02, 6.6044e+01],
          [1.7214e+02, 7.8825e+01, 2.1047e+02, 9.2846e+01],
          [3.4630e+00, 9.7709e+01, 1.1583e+02, 1.3800e+02],
          [2.7108e+02, 9.1116e+01, 3.6600e+02, 1.3261e+02],
          [1.6674e+02, 6.9237e+01, 1.7688e+02, 8.0082e+01],
          [9.1865e+01, 3.1179e+01, 1.2493e+02, 7.6646e+01],
          [1.5259e+02, 1.0669e+02, 2.8799e+02, 1.1959e+02],
          [2.6081e+02, 1.7572e+01, 3.1165e+02, 9.8317e+01],
          [1.5826e+02, 7.5083e+01, 1.7011e+02, 8.2451e+01],
          [2.8424e+02, 4.9104e+01, 2.9083e+02, 5.4661e+01],
          [2.3415e+02, 6.0058e+01, 2.4483e+02, 6.9659e+01],
          [7.2853e+01, 3.2121e-01, 1.0270e+02, 3.3283e+01],
          [2.6785e+02, 5.7673e+01, 2.7644e+02, 6.3858e+01],
          [2.3138e+02, 5.8277e+01, 2.6140e+02, 8.0814e+01],
          [1.9328e+02, 7.9073e+01, 2.1029e+02, 8.7192e+01],
          [1.8110e+02, 7.8621e+01, 2.0052e+02, 8.7497e+01],
          [1.9206e+02, 8.7688e+01, 2.9381e+02, 9.9396e+01],
          [2.3252e+02, 6.2116e+01, 2.4841e+02, 7.6500e+01],
          [6.4665e+01, 7.2912e+01, 9.9762e+01, 1.1000e+02],
          [2.3620e+02, 5.8811e+01, 2.4367e+02, 6.5391e+01],
          [1.6804e+02, 5.9961e+01, 1.7636e+02, 7.2077e+01],
          [8.8310e+00, 0.0000e+00, 1.3939e+02, 1.1158e+02],
          [1.1113e+02, 9.3262e+01, 1.4717e+02, 1.0744e+02],
          [2.4634e+02, 5.3187e+01, 2.5275e+02, 5.8280e+01],
          [2.9147e+02, 5.3270e+01, 2.9661e+02, 6.2552e+01],
          [3.5433e+01, 5.4391e+01, 6.6191e+01, 8.8191e+01],
          [2.8212e+02, 5.7201e+01, 2.8999e+02, 6.3457e+01],
          [2.0218e+02, 6.5754e+01, 2.0709e+02, 6.8350e+01],
          [2.0688e+02, 8.5657e+01, 2.1707e+02, 9.2915e+01],
          [1.7944e+02, 8.5381e+01, 2.0105e+02, 9.3778e+01],
          [1.9591e+02, 8.6239e+01, 2.0922e+02, 9.2811e+01],
          [5.9543e+01, 4.1778e+01, 1.4203e+02, 8.6271e+01],
          [2.6872e+02, 5.0889e+01, 2.7835e+02, 5.5883e+01],
          [1.5736e+02, 8.3503e+01, 1.7518e+02, 8.9502e+01],
          [2.1135e+02, 8.1976e+01, 2.2294e+02, 9.1281e+01],
          [5.3724e+01, 8.3323e+01, 8.7975e+01, 1.1918e+02],
          [1.5792e+02, 8.0073e+01, 1.7484e+02, 8.5885e+01],
          [1.6765e+02, 8.2681e+01, 1.9522e+02, 9.0181e+01],
          [2.1019e+02, 1.1036e+02, 3.6600e+02, 1.3563e+02],
          [2.4763e+02, 5.0243e+01, 2.5270e+02, 5.4835e+01],
          [1.5822e+02, 6.8510e+01, 1.6915e+02, 8.1664e+01],
          [3.6587e+01, 9.1486e+01, 6.4017e+01, 1.3371e+02],
          [2.3846e+02, 6.1127e+01, 2.5799e+02, 7.8107e+01],
          [1.9087e+02, 7.5154e+01, 2.2594e+02, 8.9968e+01],
          [2.7671e+02, 4.8428e+01, 2.8418e+02, 5.2952e+01],
          [2.9215e+02, 5.1463e+01, 2.9676e+02, 5.8858e+01],
          [1.2348e+02, 9.4578e+01, 1.4193e+02, 1.0552e+02],
          [2.9029e+02, 5.4530e+01, 2.9596e+02, 5.9934e+01],
          [1.5863e+02, 2.6214e+01, 2.8438e+02, 7.3452e+01],
          [9.1410e+01, 1.1942e+00, 1.2103e+02, 3.3993e+01],
          [2.5153e+02, 6.6052e+01, 2.6561e+02, 8.4095e+01],
          [2.3304e+02, 6.7200e+01, 2.5249e+02, 8.2056e+01],
          [1.9878e+02, 6.5454e+00, 3.4474e+02, 3.9449e+01],
          [2.2264e+02, 6.3344e+01, 2.3478e+02, 7.5142e+01],
          [1.8425e+02, 6.3083e+01, 2.1732e+02, 7.6522e+01],
          [2.6070e+02, 4.5322e+01, 2.9528e+02, 8.1132e+01],
          [3.1745e+02, 1.0896e+02, 3.5852e+02, 1.1692e+02],
          [1.8283e+02, 6.7612e+01, 2.1800e+02, 8.2022e+01],
          [2.4435e+02, 5.4687e+01, 2.5487e+02, 6.2706e+01],
          [1.5094e+02, 7.1173e+01, 1.7802e+02, 8.7780e+01],
          [1.5881e+02, 6.1023e+01, 1.6802e+02, 7.8135e+01],
          [1.7344e+02, 7.4097e+01, 2.8670e+02, 1.0323e+02],
          [1.3472e+02, 1.0085e+02, 2.3369e+02, 1.1296e+02],
          [1.0604e+02, 3.0122e+01, 1.4772e+02, 7.7813e+01],
          [6.2887e+01, 5.8919e+01, 8.2959e+01, 7.0106e+01],
          [1.9609e+02, 8.3851e+01, 2.1508e+02, 8.9734e+01],
          [6.7382e+01, 5.4856e+01, 1.3728e+02, 9.6747e+01],
          [5.2290e+01, 1.0373e+02, 8.7801e+01, 1.3800e+02],
          [1.0885e+02, 3.4909e+01, 1.7116e+02, 7.6123e+01],
          [2.2292e+02, 7.6773e+01, 2.3412e+02, 8.7511e+01],
          [3.8686e+01, 0.0000e+00, 1.5123e+02, 6.6528e+01],
          [2.5842e+02, 4.7827e+01, 2.6275e+02, 5.1460e+01],
          [2.1230e+02, 6.4132e+01, 2.1929e+02, 6.7018e+01],
          [2.5818e+02, 4.8861e+01, 2.6470e+02, 5.3237e+01],
          [2.3784e+02, 5.7200e+01, 2.4341e+02, 6.2123e+01],
          [2.2613e+02, 6.1904e+01, 2.3427e+02, 6.9291e+01],
          [5.3162e+01, 6.2459e+01, 9.1400e+01, 8.8083e+01],
          [2.1378e+01, 2.8177e+01, 7.0474e+01, 5.4037e+01],
          [1.2113e+02, 0.0000e+00, 2.3350e+02, 4.5563e+01],
          [2.5803e+02, 5.4809e+01, 2.6694e+02, 6.0001e+01],
          [6.3682e+01, 0.0000e+00, 1.4694e+02, 1.9648e+01],
          [2.0125e+02, 7.1173e+01, 2.3416e+02, 8.6493e+01],
          [2.0479e+02, 6.7669e+01, 2.1431e+02, 7.5964e+01],
          [2.3705e+02, 4.6889e+01, 2.4144e+02, 5.1093e+01],
          [1.7924e+02, 8.3095e+01, 2.0649e+02, 9.0043e+01],
          [1.5866e+02, 8.6387e+01, 1.8665e+02, 9.3400e+01],
          [1.7393e+02, 6.9952e+01, 1.8257e+02, 7.4647e+01],
          [4.3746e+01, 5.1331e+01, 1.3157e+02, 1.0821e+02],
          [0.0000e+00, 1.0358e+02, 6.1692e+01, 1.2430e+02],
          [2.4474e+02, 2.8838e+01, 2.8466e+02, 5.8195e+01],
          [2.2217e+02, 7.4627e+01, 2.3641e+02, 8.2889e+01],
          [1.3123e+02, 9.1775e+01, 2.1393e+02, 1.2134e+02],
          [3.2397e+02, 1.1017e+02, 3.5049e+02, 1.2269e+02],
          [2.0747e+02, 3.2991e+01, 3.3799e+02, 7.0380e+01],
          [1.6899e+02, 6.8558e+01, 1.7887e+02, 7.6669e+01],
          [0.0000e+00, 1.7262e+01, 2.1926e+01, 6.8675e+01],
          [1.6871e+02, 7.9381e+01, 1.9402e+02, 8.6759e+01]]),
  'scores': tensor([0.6952, 0.5879, 0.3795, 0.3002, 0.2830, 0.2025, 0.1468, 0.1450, 0.1147,
          0.1112, 0.1053, 0.0938, 0.0891, 0.0841, 0.0830, 0.0815, 0.0809, 0.0795,
          0.0776, 0.0775, 0.0771, 0.0768, 0.0768, 0.0766, 0.0763, 0.0751, 0.0750,
          0.0727, 0.0700, 0.0688, 0.0675, 0.0675, 0.0675, 0.0670, 0.0668, 0.0655,
          0.0640, 0.0634, 0.0633, 0.0626, 0.0625, 0.0624, 0.0618, 0.0601, 0.0594,
          0.0594, 0.0586, 0.0576, 0.0569, 0.0567, 0.0563, 0.0561, 0.0560, 0.0555,
          0.0548, 0.0547, 0.0543, 0.0543, 0.0541, 0.0534, 0.0528, 0.0526, 0.0526,
          0.0524, 0.0521, 0.0518, 0.0515, 0.0515, 0.0511, 0.0511, 0.0506, 0.0506,
          0.0504, 0.0499, 0.0498, 0.0498, 0.0496, 0.0492, 0.0491, 0.0489, 0.0486,
          0.0486, 0.0486, 0.0482, 0.0478, 0.0478, 0.0476, 0.0476, 0.0473, 0.0471,
          0.0468, 0.0467, 0.0466, 0.0465, 0.0461, 0.0459, 0.0456, 0.0455, 0.0452,
          0.0451, 0.0450, 0.0447, 0.0441, 0.0441, 0.0435, 0.0433, 0.0433, 0.0432,
          0.0431, 0.0424, 0.0420, 0.0419, 0.0418, 0.0416, 0.0413, 0.0413, 0.0412,
          0.0407, 0.0407, 0.0406, 0.0405, 0.0405, 0.0404, 0.0404, 0.0403, 0.0402,
          0.0400, 0.0396, 0.0395, 0.0394, 0.0394, 0.0393, 0.0388, 0.0388, 0.0388,
          0.0384, 0.0384, 0.0383, 0.0383, 0.0382, 0.0381, 0.0381, 0.0380, 0.0380,
          0.0379, 0.0375, 0.0371, 0.0369, 0.0369, 0.0365, 0.0365, 0.0363, 0.0363,
          0.0362, 0.0359, 0.0359, 0.0358, 0.0358, 0.0357, 0.0357, 0.0355, 0.0354,
          0.0350, 0.0348, 0.0346, 0.0346, 0.0345, 0.0345, 0.0344, 0.0342, 0.0341,
          0.0340, 0.0339, 0.0339, 0.0338, 0.0333, 0.0333, 0.0333, 0.0329, 0.0328,
          0.0328, 0.0328, 0.0327, 0.0322, 0.0322, 0.0321, 0.0320, 0.0319, 0.0319,
          0.0317, 0.0317, 0.0317, 0.0316, 0.0315, 0.0314, 0.0313, 0.0312, 0.0312,
          0.0312, 0.0311]),
  'labels': tensor([64, 73, 77, 72, 86, 76,  3, 76, 84, 86, 64, 86,  1, 67,  1, 86,  1, 76,
           3, 64,  1,  3, 76, 64,  1, 72,  1, 67, 72, 73,  1, 64, 64,  1,  3,  3,
           1,  3,  1,  3,  3,  1, 64,  1, 64,  1, 47, 64,  1,  1, 75, 72,  1, 64,
           1,  1,  1,  1,  1,  1,  3,  1,  1,  3,  9,  1, 86,  1,  1,  3, 64,  1,
           1, 86, 72,  1,  3,  1, 64,  1, 64,  1, 64, 64, 64,  1,  3,  1, 64, 64,
          76,  3, 64,  1,  3,  3,  3,  1, 64, 86, 76, 67,  1,  1,  1, 67, 67,  1,
          64, 76, 72,  1,  1,  1, 64,  1,  9,  1,  1, 76,  1, 86,  1,  1, 72, 62,
           1,  1, 86,  1,  3,  1,  1,  1, 64,  1,  1,  1, 86,  1,  1, 67,  1,  1,
          47,  1,  1,  1,  1, 62,  1, 72, 64,  1,  1, 72,  1,  3, 64, 84,  3,  1,
           1,  1, 76, 76, 64, 86,  1, 86, 47, 62,  1, 64,  1,  3,  1,  1,  1, 47,
          64, 72,  1, 64,  1,  1,  1,  1,  1,  3, 64, 84,  1,  1, 76, 84, 72,  3,
          64,  1])}]
</code></pre>
<p>From the predictions, it is certain that the scores of the boxes are very different from each other and also, there are a lot of overlaps.<br>
I have also tried <code>nms(preds1[0]['boxes'], preds1[0]['scores'], 0.3)</code>, but that too produces the same result as <code>batched_nms</code><br>
For drawing the bounding boxes, I am using <code>draw_bounding_boxes</code> method and the output image is:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/0/f0670295634a434f74dfb79b25ecb6241be08085.png" data-download-href="https://discuss.pytorch.org/uploads/default/f0670295634a434f74dfb79b25ecb6241be08085" title="pred1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/0/f0670295634a434f74dfb79b25ecb6241be08085_2_348x500.png" alt="pred1" data-base62-sha1="yiHi2EiT53UDUqSwn19UwDH2n1H" width="348" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/0/f0670295634a434f74dfb79b25ecb6241be08085_2_348x500.png, https://discuss.pytorch.org/uploads/default/original/3X/f/0/f0670295634a434f74dfb79b25ecb6241be08085.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/f/0/f0670295634a434f74dfb79b25ecb6241be08085.png 2x" data-dominant-color="ABB1AA"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">pred1</span><span class="informations">496×712 255 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

JigyasaKatrolia: <p>Hello,<br>
Did you manage to solve this issue? I am facing the same problem<br>
Thanks!</p>

Amit_Sur: <p>Hi.<br>
Try applying a confidence threshold first, then apply <code>nms</code> or <code>batched_nms</code>. That worked for me.</p>