yolov5训练PASCAL VOC数据集调试报错记录

1. UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument.

【解决方法】找到目录D:\Users\JMan\anaconda3\envs\yolov5\Lib\site-packages\torch下的functional.py文件做如下修改

    # Remove this two weeks after landing.
    kwargs = {
    
    } if indexing is None else {
    
    'indexing': indexing}
    return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]

改为

    # Remove this two weeks after landing.
    kwargs = {
    
    } if indexing is None else {
    
    'indexing': indexing}
    return _VF.meshgrid(tensors, **kwargs,indexing='ij')  # type: ignore[attr-defined]

2. OSError: [WinError 1455] 页面文件太小,无法完成操作。

parser.add_argument('--workers', type=int, default=16, help='maximum number of dataloader workers')

train.py中这一行的16改小,我这边改到4勉强能跑,就是说没有金刚钻真干不了瓷器活……

3. OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

原因是torch包中包含了名为libiomp5md.dll的文件,与Anaconda环境中的同一个文件出现了某种冲突,需要删除Anaconda环境中的那个。
路径D:\Users\JMan\anaconda3\envs\yolov5\Library\bin找到名为libiomp5md.dll的文件删掉。

4.RuntimeError: result type Float can't be cast to the desired output type __int64

原因是:loss计算过程中,出现Float的数值精度,需要进行精度的强转换。
解决方法:对【utils】中的【loss.py】里面的两处内容进行修改。
178行修改如下:

 anchors, shape = self.anchors[i], p[i].shape 

211行修改如下:

indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1)))  # image, anchor, grid

训练结果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45246566/article/details/129187058
今日推荐