Yolov5 training PASCAL VOC data set debugging error record

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

[Solution] Find the file in the directory D:\Users\JMan\anaconda3\envs\yolov5\Lib\site-packages\torch and make the following modificationsfunctional.py

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

Change to

    # 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')

The 16 in this line in train.py was changed to a small value. I changed it to 4 here and could barely run. That is to say, I can’t do porcelain work without diamonds...

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

The reason is that the torch package contains a file named libiomp5md.dll, which conflicts with the same file in the Anaconda environment, and the one in the Anaconda environment needs to be deleted.
Path D:\Users\JMan\anaconda3\envs\yolov5\Library\bin Find the file named libiomp5md.dll and delete it.

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

The reason is: During the loss calculation process, the numerical precision of Float appears, and a strong conversion of precision is required.
Solution: Modify two contents in [loss.py] in [utils].
Line 178 is modified as follows:

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

Line 211 is modified as follows:

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

training results

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_45246566/article/details/129187058