在pycharm运行yoloV5中的train.py时遇到
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. ~~~The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
问题分析:
显然这里报错提示你要将 'np:int' 改为 'int' ,但是应该在哪里该这里并没有提示,我们先找到
Traceback (most recent call last):
..............
寻找其中有没有关于 'np:int' 的追踪,我找到了
File "F:\depth_study\a_little_concerningcode\yolov5-6.0\yolov5-6.0\utils\datasets.py", line 445, in __init__
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
^^^^^^
然后点击地址(F:\depth_study\a_little_concerningcode\yolov5-6.0\yolov5-6.0\utils\datasets.py),可以发现问题所在
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
将其改为
bi = np.floor(np.arange(n) / batch_size).astype(int) # batch index
问题就可以解决!