Get error for using nms, : 'module' object is not callable

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?

Upvotes: 0

Views: 383

Answers (1)

Shai
Shai

Reputation: 114926

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(...).

Upvotes: 0

Related Questions