Tag Archives: Python Programming / pytorch

(29)RuntimeError: cuda runtime error (999)

Problem Description: when running the improved yolov4 program, I accidentally encountered the top row of “PC” on the keyboard and one of the three keys around it, and the program directly reported an error:

THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1595629403081/work/aten/src/THC/THCGeneral.cpp line=47 error=999 : unknown error
Traceback (most recent call last):
  File "/home/lidan/PycharmProjects/yolov4/B_mobilenet-yolov4-lite_378/train.py", line 280, in <module>
    net = net.cuda()
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 458, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  [Previous line repeated 3 more times]
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 376, in _apply
    param_applied = fn(param)
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 458, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "/home/lidan/.conda/envs/ultralytics_yolov3/lib/python3.7/site-packages/torch/cuda/__init__.py", line 190, in _lazy_init
    torch._C._cuda_init()
RuntimeError: cuda runtime error (999) : unknown error at /opt/conda/conda-bld/pytorch_1595629403081/work/aten/src/THC/THCGeneral.cpp:47

In addition, some other pages of the computer are not easy to use, such as the web page cannot be displayed completely…

Solution: restart the computer and everything returns to normal

(26)RuntimeError: Error(s) in loading state_dict for YoloBody:size mismatch for yolo_head3.1.weight

Run B_ Yolov4 an error is reported when calculating the map:

RuntimeError: Error(s) in loading state_dict for YoloBody:
	size mismatch for yolo_head3.1.weight: copying a param with shape torch.Size([75, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 256, 1, 1]).
	size mismatch for yolo_head3.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).
	size mismatch for yolo_head2.1.weight: copying a param with shape torch.Size([75, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 512, 1, 1]).
	size mismatch for yolo_head2.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).
	size mismatch for yolo_head1.1.weight: copying a param with shape torch.Size([75, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 1024, 1, 1]).
	size mismatch for yolo_head1.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).

resolvent:

Check class in train.py_ Names and num_ The classes are all right, so it is determined that it is a problem in several programs called when calculating map. Finally, it is found that the number of classes in yolo.py is wrong,

"classes_path"      : 'model_data/coco_classes.txt',

Replace with:

"classes_path"      : 'model_data/voc_classes.txt',

ginseng https://github.com/bubbliiiing/yolo3-pytorch/issues/17

https://blog.csdn.net/nangg1047/article/details/116073131