Closed piyalitt closed 3 years ago
https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/models/yolo.py#L141-L142
b[:, 4].data += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
b[:, 5:].data += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
Thank you. It works :)
Invoke in first line in notebook and your fine
!pip uninstall torch !pip uninstall torch # run this command twice !pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchtext==0.8 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.htmly
https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/models/yolo.py#L141-L142
b[:, 4].data += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image) b[:, 5:].data += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
Thank you! Did you already commit the solution to all models?
First of all, thank you for sharing your code. This is the first time that I had a problem with ScaledYolov4, so I am not sure if there are any updates that may affect Google Colab's work? Thank you for your assistance.
/content/ScaledYOLOv4 Using CUDA device0 _CudaDeviceProperties(name='Tesla P100-PCIE-16GB', total_memory=16280MB)
Namespace(adam=False, batch_size=16, bucket='', cache_images=True, cfg='./models/yolov4-p5.yaml', data='../data.yaml', device='', epochs=101, evolve=False, global_rank=-1, hyp='data/hyp.finetune.yaml', img_size=[896, 896], local_rank=-1, logdir='runs/', multi_scale=False, name='yolov4-p5-results', noautoanchor=False, nosave=False, notest=False, rect=False, resume=False, single_cls=False, sync_bn=False, total_batch_size=16, weights='/content/drive/MyDrive/Weight_AI/best_yolov4-p5-results.pt', world_size=1) Start Tensorboard with "tensorboard --logdir runs/", view at http://localhost:6006/ 2021-03-09 16:48:10.546993: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0 Hyperparameters {'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.5, 'scale': 0.8, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mixup': 0.2} Overriding ./models/yolov4-p5.yaml nc=80 with nc=2
0 -1 1 928 models.common.Conv [3, 32, 3, 1]
train(hyp, opt, device, tb_writer)
File "train.py", line 65, in train
model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc).to(device) # create
File "/content/ScaledYOLOv4/models/yolo.py", line 83, in init
self._initialize_biases() # only run once
File "/content/ScaledYOLOv4/models/yolo.py", line 141, 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.
CPU times: user 28.9 ms, sys: 10.6 ms, total: 39.5 ms
Wall time: 8.64 s
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 19904 models.common.BottleneckCSP [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 1 161152 models.common.BottleneckCSP [128, 128, 3]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 1 2614016 models.common.BottleneckCSP [256, 256, 15]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 10438144 models.common.BottleneckCSP [512, 512, 15]
9 -1 1 4720640 models.common.Conv [512, 1024, 3, 2]
10 -1 1 20728832 models.common.BottleneckCSP [1024, 1024, 7]
11 -1 1 7610368 models.common.SPPCSP [1024, 512, 1]
12 -1 1 131584 models.common.Conv [512, 256, 1, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 8 1 131584 models.common.Conv [512, 256, 1, 1]
15 [-1, -2] 1 0 models.common.Concat [1]
16 -1 1 2298880 models.common.BottleneckCSP2 [512, 256, 3]
17 -1 1 33024 models.common.Conv [256, 128, 1, 1]
18 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
19 6 1 33024 models.common.Conv [256, 128, 1, 1]
20 [-1, -2] 1 0 models.common.Concat [1]
21 -1 1 576000 models.common.BottleneckCSP2 [256, 128, 3]
22 -1 1 295424 models.common.Conv [128, 256, 3, 1]
23 -2 1 295424 models.common.Conv [128, 256, 3, 2]
24 [-1, 16] 1 0 models.common.Concat [1]
25 -1 1 2298880 models.common.BottleneckCSP2 [512, 256, 3]
26 -1 1 1180672 models.common.Conv [256, 512, 3, 1]
27 -2 1 1180672 models.common.Conv [256, 512, 3, 2]
28 [-1, 11] 1 0 models.common.Concat [1]
29 -1 1 9185280 models.common.BottleneckCSP2 [1024, 512, 3]
30 -1 1 4720640 models.common.Conv [512, 1024, 3, 1]
31 [22, 26, 30] 1 50260 models.yolo.Detect [2, [[13, 17, 31, 25, 24, 51, 61, 45], [48, 102, 119, 96, 97, 189, 217, 184], [171, 384, 324, 451, 616, 618, 800, 800]], [256, 512, 1024]] Traceback (most recent call last): File "train.py", line 443, in