Ultralytics
1. TT100K data set: data.zip, code.zip, mypython.zip annotations are detailed in the file data\annotations
Reference links for data set information:
Tsinghua-Tencent 100K Tutorial
2. D://dataset//mypython,
tt100k_to_voc_test.py and tt100k_to_voc_train.py run (path minor changes)
Correct according to your own situation tt100k_parent_dir = "D:\\datasets\\"
Run to generate TT100K/VOCdevkit VOC2007 / Annotations file in XML format file
3. Copy TT100K/data/test and train all of the pictures to TT100K/VOCdevkit/VOC2007 / JPEGImages
4. in ultralytics/ultralytics:
-
VOCdevkit
-
testfiles
-
prepare_data.py
5. Divide the training set and the verification set by running prepare_data.py
Run the images and labels folder under VOCdevkit,
- images--train and val, images of training set and verification set
- labels--train and val, training set and verification set labels (yolo format).txt
Model training
pip install ultralytics
yolo detect train data=ultralytics/cfg/datasets/VOC-tt100k.yaml model=ultralytics/weights/yolov8s.pt epochs=300 imgsz=640 batch=8 workers=4 patience=150 name=train_yolov8s
NVIDIA A100-SXM4-80GB Dual sim training
An epoch is about 13 seconds
yolo detect train data=ultralytics/cfg/datasets/VOC-tt100k.yaml model=ultralytics/weights/yolov8s.pt epochs=300 imgsz=640 batch=128 workers=16 patience=150 name=train_yolov8s device=0,1
(base) root@studio:~/Neewt/ultralytics# yolo detect train data=ultralytics/cfg/datasets/VOC-tt100k.yaml model=ultralytics/weights/yolov8s.pt epochs=300 imgsz=640 batch=128 workers=16 patience=150 name=train_yolov8s device=0,1
Ultralytics YOLOv8.2.28 🚀 Python-3.11.5 torch-2.3.1+cu121 CUDA:0 (NVIDIA A100-SXM4-80GB, 81051MiB)
CUDA:1 (NVIDIA A100-SXM4-80GB, 81051MiB)
engine/trainer: task=detect, mode=train, model=ultralytics/weights/yolov8s.pt, data=ultralytics/cfg/datasets/VOC-tt100k.yaml, epochs=300, time=None, patience=150, batch=128, imgsz=640, save=True, save_period=-1, cache=False, device=(0, 1), workers=16, project=None, name=train_yolov8s3, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, bgr=0.0, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs/detect/train_yolov8s3
Overriding model.yaml nc=80 with nc=45
from n params module arguments
0 -1 1 928 ultralytics.nn.modules.conv.Conv [3, 32, 3, 2]
1 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
2 -1 1 29056 ultralytics.nn.modules.block.C2f [64, 64, 1, True]
3 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
4 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
5 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
6 -1 2 788480 ultralytics.nn.modules.block.C2f [256, 256, 2, True]
7 -1 1 1180672 ultralytics.nn.modules.conv.Conv [256, 512, 3, 2]
8 -1 1 1838080 ultralytics.nn.modules.block.C2f [512, 512, 1, True]
9 -1 1 656896 ultralytics.nn.modules.block.SPPF [512, 512, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 1 591360 ultralytics.nn.modules.block.C2f [768, 256, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1]
16 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1]
19 -1 1 590336 ultralytics.nn.modules.conv.Conv [256, 256, 3, 2]
20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 1 1969152 ultralytics.nn.modules.block.C2f [768, 512, 1]
22 [15, 18, 21] 1 2133463 ultralytics.nn.modules.head.Detect [45, [128, 256, 512]]
Model summary: 225 layers, 11153015 parameters, 11152999 gradients, 28.7 GFLOPs
Transferred 349/355 items from pretrained weights
DDP: debug command /root/.conda/bin/python -m torch.distributed.run --nproc_per_node 2 --master_port 48203 /root/.config/Ultralytics/DDP/_temp_6f1wa67l140338511809680.py
Ultralytics YOLOv8.2.28 🚀 Python-3.11.5 torch-2.3.1+cu121 CUDA:0 (NVIDIA A100-SXM4-80GB, 81051MiB)
CUDA:1 (NVIDIA A100-SXM4-80GB, 81051MiB)
TensorBoard: Start with 'tensorboard --logdir runs/detect/train_yolov8s3', view at http://localhost:6006/
Overriding model.yaml nc=80 with nc=45
Transferred 349/355 items from pretrained weights
Freezing layer 'model.22.dfl.conv.weight'
AMP: running Automatic Mixed Precision (AMP) checks with YOLOv8n...
AMP: checks passed ✅
train: Scanning /root/Neewt/ultralytics/ultralytics/VOCdevkit/labels/train.cache... 7295 images, 0 backgrounds, 0 corrupt: 100%|██████████| 7295/7295 [00:00<?, ?it/s]
val: Scanning /root/Neewt/ultralytics/ultralytics/VOCdevkit/labels/val.cache... 1875 images, 0 backgrounds, 0 corrupt: 100%|██████████| 1875/1875 [00:00<?, ?it/s]
Plotting labels to runs/detect/train_yolov8s3/labels.jpg...
optimizer: 'optimizer=auto' found, ignoring 'lr0=0.01' and 'momentum=0.937' and determining best 'optimizer', 'lr0' and 'momentum' automatically...
optimizer: SGD(lr=0.01, momentum=0.9) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.001), 63 bias(decay=0.0)
TensorBoard: model graph visualization added ✅
Image sizes 640 train, 640 val
Using 32 dataloader workers
Logging results to runs/detect/train_yolov8s3
Starting training for 300 epochs...
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
1/300 15.2G 1.459 9.329 0.9271 217 640: 100%|██████████| 57/57 [00:20<00:00, 2.81it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:05<00:00, 2.78it/s]
all 1875 4720 0.287 0.193 0.106 0.0688
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
2/300 15.6G 1.201 2.681 0.8452 229 640: 100%|██████████| 57/57 [00:13<00:00, 4.09it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:04<00:00, 3.02it/s]
all 1875 4720 0.286 0.366 0.232 0.145
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
3/300 15.1G 1.292 2.104 0.8614 224 640: 100%|██████████| 57/57 [00:14<00:00, 4.02it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:05<00:00, 2.98it/s]
all 1875 4720 0.381 0.35 0.276 0.169
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
4/300 15.1G 1.253 1.732 0.8661 167 640: 100%|██████████| 57/57 [00:13<00:00, 4.11it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:05<00:00, 2.99it/s]
all 1875 4720 0.371 0.333 0.258 0.154
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
5/300 15G 1.184 1.552 0.8635 192 640: 100%|██████████| 57/57 [00:13<00:00, 4.20it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:04<00:00, 3.02it/s]
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
298/300 15G 0.4133 0.2241 0.7723 172 640: 100%|██████████| 57/57 [00:13<00:00, 4.18it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:04<00:00, 3.06it/s]
all 1875 4720 0.838 0.815 0.868 0.673
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
299/300 14.9G 0.4088 0.2271 0.7713 137 640: 100%|██████████| 57/57 [00:13<00:00, 4.23it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:04<00:00, 3.06it/s]
all 1875 4720 0.838 0.815 0.867 0.673
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
300/300 15G 0.412 0.2239 0.7753 156 640: 100%|██████████| 57/57 [00:13<00:00, 4.18it/s]
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:04<00:00, 3.04it/s]
all 1875 4720 0.839 0.815 0.867 0.673
300 epochs completed in 1.599 hours.
Optimizer stripped from runs/detect/train_yolov8s3/weights/last.pt, 22.6MB
Optimizer stripped from runs/detect/train_yolov8s3/weights/best.pt, 22.6MB
Validating runs/detect/train_yolov8s3/weights/best.pt...
Ultralytics YOLOv8.2.28 🚀 Python-3.11.5 torch-2.3.1+cu121 CUDA:0 (NVIDIA A100-SXM4-80GB, 81051MiB)
CUDA:1 (NVIDIA A100-SXM4-80GB, 81051MiB)
Model summary (fused): 168 layers, 11142999 parameters, 0 gradients, 28.5 GFLOPs
Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 15/15 [00:06<00:00, 2.41it/s]
all 1875 4720 0.869 0.791 0.87 0.677
i2 86 89 0.908 0.773 0.841 0.602
i4 135 143 0.884 0.802 0.926 0.668
i5 270 289 0.943 0.859 0.933 0.667
il100 29 29 0.967 0.966 0.991 0.832
il60 81 109 0.945 0.954 0.982 0.815
il80 62 72 0.856 0.875 0.939 0.8
io 108 165 0.875 0.788 0.891 0.679
ip 54 59 0.84 0.763 0.85 0.513
p10 69 71 0.761 0.672 0.723 0.561
p11 294 297 0.9 0.817 0.903 0.66
p12 34 34 0.921 0.676 0.794 0.589
p19 22 22 0.737 0.773 0.819 0.698
p23 59 65 0.932 0.831 0.922 0.761
p26 154 166 0.944 0.805 0.92 0.735
p27 32 32 0.969 0.968 0.969 0.778
p3 37 37 0.934 0.811 0.898 0.756
p5 56 60 0.865 0.833 0.897 0.703
p6 21 21 0.669 0.579 0.723 0.53
pg 34 34 0.94 0.919 0.973 0.713
ph4 26 27 0.881 0.704 0.836 0.664
ph4.5 35 36 0.939 0.861 0.926 0.769
ph5 22 26 0.823 0.846 0.883 0.708
pl100 80 148 0.931 0.946 0.983 0.852
pl120 55 68 0.934 0.912 0.97 0.835
pl20 26 26 0.835 0.538 0.722 0.544
pl30 104 104 0.842 0.76 0.817 0.647
pl40 253 260 0.896 0.764 0.883 0.671
pl5 62 89 0.867 0.73 0.887 0.636
pl50 212 215 0.853 0.649 0.826 0.598
pl60 151 158 0.735 0.804 0.821 0.678
pl70 22 22 0.946 0.795 0.865 0.71
pl80 160 168 0.902 0.821 0.909 0.736
pm20 21 22 0.729 0.818 0.849 0.689
pm30 19 19 0.76 0.632 0.745 0.664
pm55 22 22 0.87 0.864 0.908 0.745
pn 572 593 0.919 0.858 0.944 0.698
pne 373 400 0.972 0.864 0.948 0.669
po 180 247 0.848 0.725 0.816 0.626
pr40 51 51 0.939 0.9 0.961 0.83
w13 22 22 0.85 0.818 0.908 0.663
w32 27 27 0.729 0.519 0.666 0.455
w55 37 37 0.908 0.804 0.936 0.712
w57 77 85 0.86 0.865 0.857 0.587
w59 28 28 0.715 0.857 0.842 0.594
wo 20 26 0.857 0.46 0.557 0.403
Speed: 0.1ms preprocess, 0.7ms inference, 0.0ms loss, 0.6ms postprocess per image
Results saved to runs/detect/train_yolov8s3
💡 Learn more at https://docs.ultralytics.com/modes/train
(base) root@studio:~/Neewt/ultralytics#