np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself.
时间: 2024-06-09 11:08:54 浏览: 263
np.int是NumPy库中的一个别名,它是内置的int类型的过时别名。为了避免在现有代码中出现错误,建议直接使用int。这样做不会改变任何行为,并且是安全的。如果要替换np.int,您可以使用np.int64或np.int32等来指定精度。有关当前使用的详细信息,请参考发布说明链接:https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations。
相关问题
`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. \[1\]\[2\]\[3\]
这个报错是因为在训练YOLO模型时使用了已经被弃用的`np.int`别名,而新版本的NumPy中已经不再支持这个别名。为了避免这个错误,你需要直接使用`int`关键字。如果需要指定精度,可以使用`np.int64`或`np.int32`。如果你想查看当前使用情况,可以参考发布说明链接获取更多信息。这个别名在NumPy 1.20中被弃用。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *3* [【YOLO问题记录】AttributeError: module ‘numpy‘ has no attribute ‘int‘.解决方案](https://blog.csdn.net/weixin_51972142/article/details/130664737)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [yolov5lite v1.4 踩坑记录](https://blog.csdn.net/weixin_51732593/article/details/130878662)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文