When i try to train on a custom dataset, im getting an error message from train.py, and google_utils.py. here is it:
C:\Users\vikra\yolov5>python train.py --img 416 --batch 16 --epochs 10 --data ./data/coco128.yaml --cfg /models/yolov5x.yaml --weights ''
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
{'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.58, '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.014, 'hsv_s': 0.68, 'hsv_v': 0.36, 'degrees': 0.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}
Namespace(adam=False, batch_size=16, bucket='', cache_images=False, cfg='.\models\yolov5x.yaml', data='./data/coco128.yaml', device='', epochs=10, evolve=False, img_size=[416], multi_scale=False, name='', noautoanchor=False, nosave=False, notest=False, rect=False, resume=False, single_cls=False, weights="''")
Using CPU
Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
from n params module arguments
0 -1 1 8800 models.common.Focus [3, 80, 3]
1 -1 1 115520 models.common.Conv [80, 160, 3, 2]
2 -1 1 315680 models.common.BottleneckCSP [160, 160, 4]
3 -1 1 461440 models.common.Conv [160, 320, 3, 2]
4 -1 1 3311680 models.common.BottleneckCSP [320, 320, 12]
5 -1 1 1844480 models.common.Conv [320, 640, 3, 2]
6 -1 1 13228160 models.common.BottleneckCSP [640, 640, 12]
7 -1 1 7375360 models.common.Conv [640, 1280, 3, 2]
8 -1 1 4099840 models.common.SPP [1280, 1280, [5, 9, 13]]
9 -1 1 20087040 models.common.BottleneckCSP [1280, 1280, 4, False]
10 -1 1 820480 models.common.Conv [1280, 640, 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 5435520 models.common.BottleneckCSP [1280, 640, 4, False]
14 -1 1 205440 models.common.Conv [640, 320, 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 1360960 models.common.BottleneckCSP [640, 320, 4, False]
18 -1 1 7704 torch.nn.modules.conv.Conv2d [320, 24, 1, 1]
19 -2 1 922240 models.common.Conv [320, 320, 3, 2]
20 [-1, 14] 1 0 models.common.Concat [1]
21 -1 1 5025920 models.common.BottleneckCSP [640, 640, 4, False]
22 -1 1 15384 torch.nn.modules.conv.Conv2d [640, 24, 1, 1]
23 -2 1 3687680 models.common.Conv [640, 640, 3, 2]
24 [-1, 10] 1 0 models.common.Concat [1]
25 -1 1 20087040 models.common.BottleneckCSP [1280, 1280, 4, False]
26 -1 1 30744 torch.nn.modules.conv.Conv2d [1280, 24, 1, 1]
27 [-1, 22, 18] 1 0 models.yolo.Detect [3, [[116, 90, 156, 198, 373, 326], [30, 61, 62, 45, 59, 119], [10, 13, 16, 30, 33, 23]]]
Model Summary: 407 layers, 8.84471e+07 parameters, 8.84471e+07 gradients
Optimizer groups: 134 .bias, 142 conv.weight, 131 other
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: 'storage.googleapis.com
Traceback (most recent call last):
File "train.py", line 394, in
train(hyp)
File "train.py", line 109, in train
google_utils.attempt_download(weights)
File "C:\Users\vikra\yolov5\utils\google_utils.py", line 36, in attempt_download
raise Exception(msg)
Exception: '' missing, try downloading from drive.google.com/drive/folders/1Drs_Aiu7xx6S-ix95f9kNsA6ueKRpN2J
train.py line 109: google_utils.attempt_download(weights)
google_utils line 36: raise Exception(msg)
Not sure how to fix this error, and not even sure whats wrong. Any help would be appreciated, thanks.
Hello @vmolakala, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
@vmolakala this may be a windows-specific error that can be resolved by using --weights "" instead of --weights ''.
Of course, no weights is the default, so you can also simply omit the --weights argument completely to achieve the same result.
You're a saint! I overlooked that as I first tested this out on my MacBook and it had worked fine. It's working now, I appreciate you getting back to me so quickly! Cheers
@vmolakala ok great, but I need your help now real quick. I need you to run two tests for me and tell me which works on your windows machine:
I need you to replace L12 with the following replacements and tell me if either fixes your original problem. Then we can implement a fix for everyone else too!
https://github.com/ultralytics/yolov5/blob/9006b85d21e33d2ca5390fa6ab469810380e5c9c/utils/google_utils.py#L10-L12
weights = weights.strip().replace('"', '') # option 1
weights = weights.strip().replace("'", '') # option 2
@vmolakala also forgot to mention, can you test both of these commands with both of the fixes? People sometimes use double quotes. Thanks!
python train.py --weights '' # run with fix 1
python train.py --weights '' # run with fix 2
python train.py --weights "" # run with fix 1
python train.py --weights "" # run with fix 2
Hello Glenn,
I added both options to the google_utils file, and am glad to say that it works and begins training. I would be glad to help anyway i can. Also, i didn't mention this in the original post because I was able to fix it, but initially when I ran the train.py file, i would get this error:
curl: (1) Protocol "'https" not supported or disabled in libcurl
Fix was just to remove the https:// in google_utils.py on
s = "curl -L -o %s 'storage.googleapis.com/ultralytics/yolov5/ckpt/%s'" % (weights, file)
^ the modified line that works
Apologies Glenn, I gave some misinformation, initially I pasted both option 1 and option 2 and then ran the commands. However I ran it again, and Option 2 alone works fine for both python train.py --weights '' and python train.py --weights "" , but Option 1 does not work for python train.py --weights ''.
Cheers, Vikram
@vmolakala great, thanks a lot! I've incorporated your updates now in https://github.com/ultralytics/yolov5/commit/d3e786ed934d6b1652cf19ee986ca75f4a36461e
Hopefully this will allow better out of the box functionality in Windows :)
Thanks for the help!