简体   繁体   English

使用 nms 时出错:“模块”对象不可调用

[英]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?我对错误感到困惑,为什么会这样?

It seems like nms is a function defined in nms.py file.似乎nmsnms.py文件中定义的函数。
When importing nms :导入nms

import nms

You import all functions in the file nms.py into the "scope" nms .您将文件nms.py中的所有函数导入“范围” nms Therefore, you should call the function nms defined in nms.py like this:因此,您应该像这样调用nms.py定义的函数nms

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 :或者,您可以从nms.py导入特定函数nms

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(...) .这会将nms函数置于全局“范围”中,您无需使用nms.nms(...)调用它,而只需使用nms(...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:“模块”对象在使用 logmmse 时不可调用 - error : 'module' object is not callable when using logmmse '模块'对象不可调用错误 - 'module' object is not callable error 出现错误:“模块”对象不可调用 - There was an error: 'module' object is not callable 类型错误:“模块”对象不可调用 - type error: 'module' object is not callable 错误“模块”object 在 Pygame 中不可调用 - Error 'module' object is not callable in Pygame 无法使用 chromedriver 调用模块 object - module object not callable using chromedriver TypeError: 'module' object is not callable error using ChromeDriver and Chrome and Selenium Python - TypeError: 'module' object is not callable error using ChromeDriver and Chrome and Selenium Python 如何解决 TypeError: 'module' object is not callable 错误使用 Selenium 和 ChromeDriver - How to address TypeError: 'module' object is not callable error using Selenium and ChromeDriver TypeError: 'module' object is not callable error with ChromeDriver and Chrome using Selenium on macos - TypeError: 'module' object is not callable error with ChromeDriver and Chrome using Selenium on macos TypeError:使用Selenium ChromeDriver Chrome和Python时,'module'对象无法调用错误 - TypeError: 'module' object is not callable error using Selenium ChromeDriver Chrome with Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM