0

My code is:

keep, num_to_keep, _ = nms(proposals, scores, overlap=nms_thres, top_k=nms_topk)

And I'm getting this error:

File "C:\Users\RaSoul\LaneATT\lib\models\laneatt.py", line 129, in nms
    keep, num_to_keep, _ = nms(proposals, scores, overlap=nms_thres, top_k=nms_topk)
TypeError: 'module' object is not callable

I'm confused with the error, why is that?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
  • 1
    Please read [mre]. We have no idea what `nms` function you’re trying to call. All import statements must be included for us to understand that. – Cris Luengo Jul 25 '21 at 17:44
  • 1
    How did you import that `nms` name? Which library is it from? – AKX Jul 25 '21 at 17:44
  • You cannot use the brackets because it is not a function data type, but a ```module``` object. So, maybe you cannot put parameters in the parentheses. – Om Parab Jul 27 '21 at 06:43

1 Answers1

0

It seems like nms is a function defined in nms.py file.
When importing nms:

import nms

You import all functions in the file nms.py into the "scope" nms. Therefore, you should call the function nms defined in nms.py like this:

keep, num_to_keep, _ = nms.nms(proposals, scores, overlap=nms_thres, top_k=nms_topk)

Alternatively, you can import the specific function nms from nms.py:

from nms import nms

This will put the nms function in the global "scope" and you will not need to call it with nms.nms(...), but rather use simply nms(...).

Shai
  • 111,146
  • 38
  • 238
  • 371