TypeError: nms(): incompatible function arguments

username: vikrant_karale
cooked: <p>Hi,<br>
I am training the faster RCNN network repository by <a href="https://github.com/ruotianluo/pytorch-faster-rcnn" rel="nofollow noopener">Ruotianluo</a> on the custom dataset using Resnet-101 as pretrained network. I am using pytorch 1.0 and have followed the instructions given at <a href="https://github.com/ruotianluo/pytorch-faster-rcnn" rel="nofollow noopener">readme</a> file. During the testing phase, I am getting the following error:</p>
<p>keep = nms(torch.from_numpy(cls_boxes), cls_scores, cfg.TEST.NMS).numpy() if cls_dets.size &gt; 0 else []<br>
TypeError: nms(): incompatible function arguments. The following argument types are supported:</p>
<ol>
<li>(arg0: at::Tensor, arg1: at::Tensor, arg2: float) -&gt; at::Tensor</li>
</ol>
<p>Invoked with: tensor([[0.0000e+00, 0.0000e+00, 1.0221e+00, 5.4822e+03],<br>
[0.0000e+00, 5.4990e-01, 2.2753e+03, 2.8104e+02],<br>
[0.0000e+00, 1.0625e+03, 1.3335e+03, 3.8428e+03],<br>
…,<br>
[2.6648e+03, 2.0081e+03, 2.9550e+03, 2.4189e+03],<br>
[2.6647e+03, 2.6189e+03, 2.9550e+03, 3.0278e+03],<br>
[2.7726e+03, 3.5094e+03, 2.9549e+03, 3.8692e+03]]), array([2.70299730e-04, 1.00002660e-04, 2.72640167e-03, 3.21497936e-07,<br>
1.14832801e-05, 2.80641456e-04, 4.03714133e-04, 5.07029565e-03,<br>
1.66540360e-03, 1.03055080e-03, 1.06837589e-03, 5.88695048e-06,<br>
5.32354042e-03, 2.56876322e-03, 1.23509474e-03, 3.06308619e-03,<br>
7.70849059e-04, 5.46014216e-03, 5.81437489e-03, 1.72483083e-03,<br>
1.58138828e-05, 1.49555062e-03, 2.70299730e-04, 6.58484735e-03,<br>
4.72948467e-03, 8.45494680e-04, 1.58138828e-05, 5.37969545e-03,<br>
1.67749869e-03, 3.90293030e-03, 1.08793552e-03, 3.44917469e-04,<br>
5.67304669e-03, 3.40397586e-03, 4.08024341e-03, 2.55823426e-04,<br>
9.69075889e-04, 6.39689481e-03, 8.83885805e-05, 6.65730913e-05,<br>
9.17084399e-05, 4.22023423e-03, 6.68010628e-03, 7.07854331e-03,<br>
5.84635651e-03, 4.00950550e-04, 5.81519352e-03, 4.89267753e-04,<br>
2.91446719e-04, 1.58034716e-04, 4.81229334e-04, 1.88520569e-02,<br>
2.44311569e-03, 2.69115344e-03, 7.12179870e-04, 4.73272195e-03,<br>
1.68355403e-03, 5.03084064e-03, 1.67948252e-04, 2.75753235e-04,<br>
6.26731804e-03, 4.88223089e-03, 4.81953612e-03, 4.78481315e-03,<br>
3.50105329e-05, 5.42840389e-05, 7.18200067e-03, 1.81344664e-03,<br>
5.52249653e-03, 2.94469506e-03, 8.39689374e-03, 8.48808326e-03,<br>
6.51832391e-03, 7.45762512e-03, 7.58010283e-05, 5.79881389e-03,<br>
4.87986626e-03, 1.11800960e-04, 3.98953166e-03, 4.81223641e-03,<br>
5.11724129e-03, 1.40284770e-03, 5.59289521e-03, 2.72502166e-05,<br>
3.64372344e-03, 5.14260866e-03, 5.46029722e-03, 4.70420718e-03,<br>
5.74348553e-04, 2.96767048e-05, 2.77027339e-05, 1.09875773e-03,<br>
1.98731050e-02, 2.71765911e-03, 1.58187584e-03, 3.17570521e-04,<br>
3.74887930e-03, 3.25424880e-05, 3.30279036e-05, 2.45437026e-03,<br>
5.10835601e-03, 2.70299730e-04, 3.07594566e-03, 2.70299730e-04,<br>
7.14927819e-03, 8.08716007e-03, 8.62293877e-03, 8.35602265e-03,<br>
8.39316752e-03, 8.34342465e-03, 4.21046279e-03, 8.47893607e-05,<br>
7.95532390e-03, 4.07279658e-05, 5.66848139e-05, 4.73289219e-05,<br>
4.63588658e-05, 6.03357656e-03, 7.39429961e-05, 2.37643416e-03,<br>
6.40213769e-03, 7.11684720e-07, 4.87616984e-03, 9.11037932e-05,<br>
1.90485409e-03, 3.76293174e-04, 1.81363020e-02, 1.05572813e-04,<br>
3.36897792e-03, 6.71282105e-05, 4.31198860e-05, 8.77594648e-05,<br>
1.24239840e-03, 2.07423624e-02, 1.19412154e-01, 1.01495171e-02,<br>
2.86637543e-04, 5.25791850e-03, 3.49012931e-04, 7.60760065e-03,<br>
3.84917855e-03, 1.47640344e-03, 1.89344899e-03, 1.36970505e-02,<br>
1.41740916e-02, 1.15808873e-02, 2.18486739e-03, 7.51810987e-03,<br>
1.39557160e-02, 1.38875153e-02, 2.72026027e-05, 5.68931364e-03,<br>
5.68576157e-03, 5.71195362e-03, 6.77531958e-03, 5.74003765e-03,<br>
5.72772091e-03, 7.84059463e-04, 5.67423459e-03, 5.74538251e-03,<br>
5.72336651e-03, 6.57964638e-03, 5.74710919e-03, 5.71809942e-03,<br>
5.74746914e-03, 5.74208191e-03, 5.76186879e-03, 5.75490203e-03,<br>
5.72091900e-03, 5.79482364e-03, 6.19037868e-03, 6.61734166e-03,<br>
5.70682483e-03, 5.91903133e-03, 5.70774451e-03, 5.70756337e-03,<br>
5.68120694e-03, 5.68916462e-03, 5.69879683e-03, 5.67057263e-03,<br>
5.67445019e-03, 5.71942795e-03, 3.55152669e-03, 5.72872534e-03,<br>
5.67777641e-03, 6.20163558e-03, 5.63167781e-03, 5.38318604e-03,<br>
6.12615095e-03, 6.17069134e-04, 2.69697001e-03, 1.44552682e-02,<br>
1.32463302e-03, 6.00101845e-03, 1.34862936e-03, 2.08517653e-03,<br>
4.87522548e-03, 5.89176640e-03, 6.99650205e-04, 4.43076948e-04,<br>
5.58195775e-03, 2.70632654e-03, 5.39793726e-03, 1.01097366e-02,<br>
4.21473029e-04, 1.34326397e-02, 2.36888067e-04, 9.51821823e-03,<br>
4.65256767e-03, 4.62808972e-03, 3.79966293e-03, 1.17155137e-02,<br>
1.24631505e-02, 1.28668472e-02, 7.06963986e-03, 6.44341158e-03,<br>
3.21201864e-03, 4.87849349e-03, 8.87973350e-04, 7.95551823e-05,<br>
3.18069011e-03, 1.84861168e-01, 1.52178016e-03, 3.81212099e-03,<br>
4.62464232e-04, 1.79026499e-02, 1.90790102e-03, 2.39848718e-03,<br>
1.57313317e-03, 5.15618653e-04, 3.29066231e-03, 1.21549959e-03,<br>
2.11271661e-04, 1.36136217e-03, 2.99114035e-03, 3.52827592e-05,<br>
2.01672176e-03, 1.39193796e-02, 1.37136457e-03, 1.39915040e-02,<br>
1.30733177e-02, 1.10681662e-02, 1.40425237e-02, 1.39938593e-02,<br>
1.36977211e-02, 1.58815572e-04, 1.38355978e-02, 1.64725222e-02,<br>
1.39309801e-02, 1.37989977e-02, 1.31998826e-02, 1.38351629e-02,<br>
2.52948375e-03, 1.38762807e-02, 1.37608554e-02, 1.40480986e-02,<br>
1.40351709e-02, 3.38868740e-05, 1.43900774e-02, 1.40837394e-02,<br>
1.37849692e-02, 1.35461027e-02, 1.59125496e-02, 1.45644378e-02,<br>
8.42260662e-04, 1.42272199e-02, 3.85694951e-03, 2.05106786e-04,<br>
1.30090490e-02, 1.60605181e-02, 8.41802265e-03, 4.05776268e-03,<br>
3.90648190e-03, 1.40024275e-02, 4.07765014e-03, 1.38664246e-02,<br>
4.02155379e-03, 3.56480479e-03, 1.49812093e-02, 4.10265801e-03,<br>
4.06457670e-03, 4.05812496e-03, 4.03689267e-03, 4.05504089e-03,<br>
1.41536705e-02, 3.89246992e-03, 1.40437335e-02, 1.39551060e-02,<br>
4.10664594e-03, 1.37458425e-02, 4.08873148e-03, 4.07666620e-03,<br>
4.08595987e-03, 2.00582296e-03, 1.48523208e-02, 3.87094240e-03,<br>
4.09315154e-03, 4.06906707e-03, 4.10756236e-03, 2.10445211e-03],<br>
dtype=float32), 0.3</p>
<p>Any suggestions on this?</p>

username: vikrant_karale
cooked: <p>It is resolved now. It was due to type of second argument in nms. I converted the second argument to torch tensor in nms and it is working fine.</p>

username: daeunni
cooked: <p>Hi, could you share your code?</p>