python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.pt
把batchsize改小
python train.py --img 640 --batch 2 --epochs 5 --data coco128.yaml --weights yolov5s.pt
(base) C:\Users\Administrator>activate yolo
(yolo) C:\Users\Administrator>cd I:\01ldzx\YOLO\yolov5\yolov5
(yolo) C:\Users\Administrator>I:
(yolo) I:\01ldzx\YOLO\yolov5\yolov5>python train.py --img 640 --batch 2 --epochs
5 --data coco128.yaml --weights yolov5s.pt
Using torch 1.7.1 CUDA:0 (GeForce GTX 950, 2048MB)
Namespace(adam=False, batch_size=2, bucket='', cache_images=False, cfg='', data=
'coco128.yaml', device='', epochs=5, evolve=False, exist_ok=False, global_rank=-
1, hyp='data/hyp.scratch.yaml', image_weights=False, img_size=[640, 640], local_
rank=-1, log_artifacts=False, log_imgs=16, multi_scale=False, name='exp', noauto
anchor=False, nosave=False, notest=False, project='runs/train', rect=False, resu
me=False, save_dir='runs\\train\\exp12', single_cls=False, sync_bn=False, total_
batch_size=2, weights='yolov5s.pt', workers=1, world_size=1)
Start Tensorboard with "tensorboard --logdir runs/train", view at http://localho
st:6006/
Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0
005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box':
0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anch
or_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degree
s': 0.0, 'translate': 0.1, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flip
ud': 0.0, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0}
from n params module argu
ments
0 -1 1 3520 models.common.Focus [3,
32, 3]
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 641792 models.common.BottleneckCSP [256
, 256, 3]
7 -1 1 1180672 models.common.Conv [256
, 512, 3, 2]
8 -1 1 656896 models.common.SPP [512
, 512, [5, 9, 13]]
9 -1 1 1248768 models.common.BottleneckCSP [512
, 512, 1, False]
10 -1 1 131584 models.common.Conv [512
, 256, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [Non
e, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 378624 models.common.BottleneckCSP [512
, 256, 1, False]
14 -1 1 33024 models.common.Conv [256
, 128, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [Non
e, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 95104 models.common.BottleneckCSP [256
, 128, 1, False]
18 -1 1 147712 models.common.Conv [128
, 128, 3, 2]
19 [-1, 14] 1 0 models.common.Concat [1]
20 -1 1 313088 models.common.BottleneckCSP [256
, 256, 1, False]
21 -1 1 590336 models.common.Conv [256
, 256, 3, 2]
22 [-1, 10] 1 0 models.common.Concat [1]
23 -1 1 1248768 models.common.BottleneckCSP [512
, 512, 1, False]
24 [17, 20, 23] 1 229245 models.yolo.Detect [80,
[[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373,
326]], [128, 256, 512]]
Model Summary: 283 layers, 7468157 parameters, 7468157 gradients, 17.5 GFLOPS
Transferred 370/370 items from yolov5s.pt
Optimizer groups: 62 .bias, 70 conv.weight, 59 other
Scanning '..\coco128\labels\train2017.cache' for images and labels... 128 found
Scanning '..\coco128\labels\train2017.cache' for images and labels... 128 found
Analyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946
Image sizes 640 train, 640 test
Using 1 dataloader workers
Logging results to runs\train\exp12
Starting training for 5 epochs...
Epoch gpu_mem box obj cls total targets img_size
Scanning '..\coco128\labels\train2017.cache' for images and labels... 128 found
0/4 0.847G 0.04502 0.07511 0.02855 0.1487 19 64
Class Images Targets P R mAP@.
all 128 929 0.341 0.781 0.69
0.455
Epoch gpu_mem box obj cls total targets img_size
1/4 0.847G 0.04517 0.07459 0.0295 0.1493 40 64
Class Images Targets P R mAP@.
all 128 929 0.325 0.802 0.703
0.447
Epoch gpu_mem box obj cls total targets img_size
2/4 0.847G 0.04585 0.07038 0.02843 0.1447 18 64
Class Images Targets P R mAP@.
all 128 929 0.322 0.802 0.707
0.461
Epoch gpu_mem box obj cls total targets img_size
3/4 0.847G 0.0441 0.07255 0.0299 0.1466 14 64
Class Images Targets P R mAP@.
all 128 929 0.306 0.802 0.719
0.462
Epoch gpu_mem box obj cls total targets img_size
4/4 0.847G 0.04388 0.06547 0.02902 0.1384 22 64
Class Images Targets P R mAP@.
all 128 929 0.301 0.799 0.723
0.477
Optimizer stripped from runs\train\exp12\weights\last.pt, 15.2MB
Optimizer stripped from runs\train\exp12\weights\best.pt, 15.2MB
5 epochs completed in 0.060 hours.