目录
- 1. torch安装问题
- 2. ‘FreeTypeFont‘ object has no attribute ‘getsize‘报错解决
- 3. RuntimeError: result type Float can't be cast to the desired output type __int64
- 4. AttributeError: module 'numpy' has no attribute 'int'
- 5. failed: module ‘signal‘ has no attribute ‘SIGALRM‘
1. torch安装问题
安装完anaconda并创建完虚拟环境后,执行下面命令安装yolov5需要的依赖
pip install -r requirements.txt
问题是:安装完后,发现torch竟然是CPU版本的,只能手动安装了。
torch下载地址
然后依次安装torch、torchaudio、torchvision
2. ‘FreeTypeFont‘ object has no attribute ‘getsize‘报错解决
将utils 文件下的 plots.py 文件做如下修改
# w, h = self.font.getsize(label) # text width, height ##这行注释掉x0, y0, x1, y1 = self.font.getbbox(label) # text width, height ## 粘贴这两行
w, h = x1-x0, y1-y0
参考链接
3. RuntimeError: result type Float can’t be cast to the desired output type __int64
请参看链接
4. AttributeError: module ‘numpy’ has no attribute ‘int’
将出现np.int的地方修改为np.int_即可。
5. failed: module ‘signal‘ has no attribute ‘SIGALRM‘
参考链接