Traceback (most recent call last): File "E:\windows_zuomian\shoushi_Demo\Demo\handpose_control_mask_detection.py", line 114, in <module> bbox = human_RoI_mp.detect(frame) File "E:\windows_zuomian\shoushi_Demo\Demo\utils\RoI.py", line 23, in detect persons = self.detector.infer(image) File "E:\windows_zuomian\shoushi_Demo\Demo\opencv_zoo\models\person_detection_mediapipe\mp_persondet.py", line 59, in infer input_blob, pad_bias = self._preprocess(image) File "E:\windows_zuomian\shoushi_Demo\Demo\opencv_zoo\models\person_detection_mediapipe\mp_persondet.py", line 41, in _preprocess ratio_size = (np.array(image.shape[:2]) * ratio).astype(np.int) File "E:\windows_zuomian\shoushi_Demo\Demo\venv\lib\site-packages\numpy\__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'int'. `np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Process finished with exit code 1
时间: 2023-06-08 11:03:29 浏览: 386
浅谈Python traceback的优雅处理
这是一个程序运行错误,错误信息显示在第114行,代码中调用了 RoI.py 和 mp_persondet.py 两个模块。报错原因是因为 numpy 模块中的 np.int 已经被弃用,应该使用 Python 内置的 int。在旧代码中使用 int 而不是 np.int 可以避免此错误,这样不会改变任何行为并且是安全的。如果需要替换 np.int,则可以使用 np.int64 或 np.int32 等来指定精度。如果想了解当前用法,请查看发行说明链接以获取更多信息。在 NumPy 1.20 中,此别名最初被弃用;有关详细信息和指导,请参见原发行说明。
阅读全文