PeterH0323 / Smart_Construction

Base on YOLOv5 Head Person Helmet Detection on Construction Sites,基于目标检测工地安全帽和禁入危险区域识别系统,🚀😆附 YOLOv5 训练自己的数据集超详细教程🚀😆2021.3新增可视化界面❗❗
GNU General Public License v3.0
2.23k stars 468 forks source link

执行train.py错误,请教解决 #68

Closed QH-LEO closed 2 years ago

QH-LEO commented 2 years ago

(deeplearning) 172-15-16-19:Smart_Construction leo$ python3 train.py --img 640 --batch 16 --epochs 10 --data ./data/custom_data.yaml --cfg ./models/custom_yolov5.yaml --weights ./weights/yolov5s.pt Unable to revert mtime: /Library/Fonts Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex Using CPU

Namespace(cfg='./models/custom_yolov5.yaml', data='./data/custom_data.yaml', hyp='', epochs=10, batch_size=16, img_size=[640, 640], rect=False, resume=False, nosave=False, notest=False, noautoanchor=False, evolve=False, bucket='', cache_images=False, weights='./weights/yolov5s.pt', name='', device='', multi_scale=False, single_cls=False, sync_bn=False, local_rank=-1, total_batch_size=16, world_size=1) Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/ Hyperparameters {'optimizer': 'SGD', 'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}

             from  n    params  module                                  arguments

0 -1 1 5280 models.common.Focus [3, 48, 3] 1 -1 1 41664 models.common.Conv [48, 96, 3, 2] 2 -1 1 67680 models.common.BottleneckCSP [96, 96, 2] 3 -1 1 166272 models.common.Conv [96, 192, 3, 2] 4 -1 1 639168 models.common.BottleneckCSP [192, 192, 6] 5 -1 1 664320 models.common.Conv [192, 384, 3, 2] 6 -1 1 2550144 models.common.BottleneckCSP [384, 384, 6] 7 -1 1 2655744 models.common.Conv [384, 768, 3, 2] 8 -1 1 1476864 models.common.SPP [768, 768, [5, 9, 13]] 9 -1 1 4283136 models.common.BottleneckCSP [768, 768, 2, False] 10 -1 1 295680 models.common.Conv [768, 384, 1, 1] 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] 12 [-1, 6] 1 0 models.common.Concat [1] 13 -1 1 1219968 models.common.BottleneckCSP [768, 384, 2, False] 14 -1 1 74112 models.common.Conv [384, 192, 1, 1] 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] 16 [-1, 4] 1 0 models.common.Concat [1] 17 -1 1 305856 models.common.BottleneckCSP [384, 192, 2, False] 18 -1 1 332160 models.common.Conv [192, 192, 3, 2] 19 [-1, 14] 1 0 models.common.Concat [1] 20 -1 1 1072512 models.common.BottleneckCSP [384, 384, 2, False] 21 -1 1 1327872 models.common.Conv [384, 384, 3, 2] 22 [-1, 10] 1 0 models.common.Concat [1] 23 -1 1 4283136 models.common.BottleneckCSP [768, 768, 2, False] 24 [17, 20, 23] 1 32328 models.yolo.Detect [3, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [192, 384, 768]] Traceback (most recent call last): File "/Users/leo/Smart_Construction/train.py", line 469, in train(hyp, tb_writer, opt, device) File "/Users/leo/Smart_Construction/train.py", line 80, in train model = Model(opt.cfg, nc=nc).to(device) File "/Users/leo/Smart_Construction/models/yolo.py", line 74, in init self._initialize_biases() # only run once File "/Users/leo/Smart_Construction/models/yolo.py", line 131, in _initialize_biases b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image) RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.

QH-LEO commented 2 years ago

fixed

PumayHui commented 1 year ago

How do you solve it? Thank!

daqiudi commented 6 months ago

How do you solve it? Thank! RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation. can you share your solution? thanks

Vencin-Z commented 4 months ago

固定

how do you solve it?