ultralytics-opencv-headless 8.3.246__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tests/__init__.py +23 -0
- tests/conftest.py +59 -0
- tests/test_cli.py +131 -0
- tests/test_cuda.py +216 -0
- tests/test_engine.py +157 -0
- tests/test_exports.py +309 -0
- tests/test_integrations.py +151 -0
- tests/test_python.py +777 -0
- tests/test_solutions.py +371 -0
- ultralytics/__init__.py +48 -0
- ultralytics/assets/bus.jpg +0 -0
- ultralytics/assets/zidane.jpg +0 -0
- ultralytics/cfg/__init__.py +1026 -0
- ultralytics/cfg/datasets/Argoverse.yaml +78 -0
- ultralytics/cfg/datasets/DOTAv1.5.yaml +37 -0
- ultralytics/cfg/datasets/DOTAv1.yaml +36 -0
- ultralytics/cfg/datasets/GlobalWheat2020.yaml +68 -0
- ultralytics/cfg/datasets/HomeObjects-3K.yaml +32 -0
- ultralytics/cfg/datasets/ImageNet.yaml +2025 -0
- ultralytics/cfg/datasets/Objects365.yaml +447 -0
- ultralytics/cfg/datasets/SKU-110K.yaml +58 -0
- ultralytics/cfg/datasets/VOC.yaml +102 -0
- ultralytics/cfg/datasets/VisDrone.yaml +87 -0
- ultralytics/cfg/datasets/african-wildlife.yaml +25 -0
- ultralytics/cfg/datasets/brain-tumor.yaml +22 -0
- ultralytics/cfg/datasets/carparts-seg.yaml +44 -0
- ultralytics/cfg/datasets/coco-pose.yaml +64 -0
- ultralytics/cfg/datasets/coco.yaml +118 -0
- ultralytics/cfg/datasets/coco128-seg.yaml +101 -0
- ultralytics/cfg/datasets/coco128.yaml +101 -0
- ultralytics/cfg/datasets/coco8-grayscale.yaml +103 -0
- ultralytics/cfg/datasets/coco8-multispectral.yaml +104 -0
- ultralytics/cfg/datasets/coco8-pose.yaml +47 -0
- ultralytics/cfg/datasets/coco8-seg.yaml +101 -0
- ultralytics/cfg/datasets/coco8.yaml +101 -0
- ultralytics/cfg/datasets/construction-ppe.yaml +32 -0
- ultralytics/cfg/datasets/crack-seg.yaml +22 -0
- ultralytics/cfg/datasets/dog-pose.yaml +52 -0
- ultralytics/cfg/datasets/dota8-multispectral.yaml +38 -0
- ultralytics/cfg/datasets/dota8.yaml +35 -0
- ultralytics/cfg/datasets/hand-keypoints.yaml +50 -0
- ultralytics/cfg/datasets/kitti.yaml +27 -0
- ultralytics/cfg/datasets/lvis.yaml +1240 -0
- ultralytics/cfg/datasets/medical-pills.yaml +21 -0
- ultralytics/cfg/datasets/open-images-v7.yaml +663 -0
- ultralytics/cfg/datasets/package-seg.yaml +22 -0
- ultralytics/cfg/datasets/signature.yaml +21 -0
- ultralytics/cfg/datasets/tiger-pose.yaml +41 -0
- ultralytics/cfg/datasets/xView.yaml +155 -0
- ultralytics/cfg/default.yaml +130 -0
- ultralytics/cfg/models/11/yolo11-cls-resnet18.yaml +17 -0
- ultralytics/cfg/models/11/yolo11-cls.yaml +33 -0
- ultralytics/cfg/models/11/yolo11-obb.yaml +50 -0
- ultralytics/cfg/models/11/yolo11-pose.yaml +51 -0
- ultralytics/cfg/models/11/yolo11-seg.yaml +50 -0
- ultralytics/cfg/models/11/yolo11.yaml +50 -0
- ultralytics/cfg/models/11/yoloe-11-seg.yaml +48 -0
- ultralytics/cfg/models/11/yoloe-11.yaml +48 -0
- ultralytics/cfg/models/12/yolo12-cls.yaml +32 -0
- ultralytics/cfg/models/12/yolo12-obb.yaml +48 -0
- ultralytics/cfg/models/12/yolo12-pose.yaml +49 -0
- ultralytics/cfg/models/12/yolo12-seg.yaml +48 -0
- ultralytics/cfg/models/12/yolo12.yaml +48 -0
- ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +53 -0
- ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +45 -0
- ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +45 -0
- ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +57 -0
- ultralytics/cfg/models/v10/yolov10b.yaml +45 -0
- ultralytics/cfg/models/v10/yolov10l.yaml +45 -0
- ultralytics/cfg/models/v10/yolov10m.yaml +45 -0
- ultralytics/cfg/models/v10/yolov10n.yaml +45 -0
- ultralytics/cfg/models/v10/yolov10s.yaml +45 -0
- ultralytics/cfg/models/v10/yolov10x.yaml +45 -0
- ultralytics/cfg/models/v3/yolov3-spp.yaml +49 -0
- ultralytics/cfg/models/v3/yolov3-tiny.yaml +40 -0
- ultralytics/cfg/models/v3/yolov3.yaml +49 -0
- ultralytics/cfg/models/v5/yolov5-p6.yaml +62 -0
- ultralytics/cfg/models/v5/yolov5.yaml +51 -0
- ultralytics/cfg/models/v6/yolov6.yaml +56 -0
- ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +48 -0
- ultralytics/cfg/models/v8/yoloe-v8.yaml +48 -0
- ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +28 -0
- ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +28 -0
- ultralytics/cfg/models/v8/yolov8-cls.yaml +32 -0
- ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +58 -0
- ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +60 -0
- ultralytics/cfg/models/v8/yolov8-ghost.yaml +50 -0
- ultralytics/cfg/models/v8/yolov8-obb.yaml +49 -0
- ultralytics/cfg/models/v8/yolov8-p2.yaml +57 -0
- ultralytics/cfg/models/v8/yolov8-p6.yaml +59 -0
- ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +60 -0
- ultralytics/cfg/models/v8/yolov8-pose.yaml +50 -0
- ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +49 -0
- ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +59 -0
- ultralytics/cfg/models/v8/yolov8-seg.yaml +49 -0
- ultralytics/cfg/models/v8/yolov8-world.yaml +51 -0
- ultralytics/cfg/models/v8/yolov8-worldv2.yaml +49 -0
- ultralytics/cfg/models/v8/yolov8.yaml +49 -0
- ultralytics/cfg/models/v9/yolov9c-seg.yaml +41 -0
- ultralytics/cfg/models/v9/yolov9c.yaml +41 -0
- ultralytics/cfg/models/v9/yolov9e-seg.yaml +64 -0
- ultralytics/cfg/models/v9/yolov9e.yaml +64 -0
- ultralytics/cfg/models/v9/yolov9m.yaml +41 -0
- ultralytics/cfg/models/v9/yolov9s.yaml +41 -0
- ultralytics/cfg/models/v9/yolov9t.yaml +41 -0
- ultralytics/cfg/trackers/botsort.yaml +21 -0
- ultralytics/cfg/trackers/bytetrack.yaml +12 -0
- ultralytics/data/__init__.py +26 -0
- ultralytics/data/annotator.py +66 -0
- ultralytics/data/augment.py +2801 -0
- ultralytics/data/base.py +435 -0
- ultralytics/data/build.py +437 -0
- ultralytics/data/converter.py +855 -0
- ultralytics/data/dataset.py +834 -0
- ultralytics/data/loaders.py +704 -0
- ultralytics/data/scripts/download_weights.sh +18 -0
- ultralytics/data/scripts/get_coco.sh +61 -0
- ultralytics/data/scripts/get_coco128.sh +18 -0
- ultralytics/data/scripts/get_imagenet.sh +52 -0
- ultralytics/data/split.py +138 -0
- ultralytics/data/split_dota.py +344 -0
- ultralytics/data/utils.py +798 -0
- ultralytics/engine/__init__.py +1 -0
- ultralytics/engine/exporter.py +1578 -0
- ultralytics/engine/model.py +1124 -0
- ultralytics/engine/predictor.py +508 -0
- ultralytics/engine/results.py +1522 -0
- ultralytics/engine/trainer.py +974 -0
- ultralytics/engine/tuner.py +448 -0
- ultralytics/engine/validator.py +384 -0
- ultralytics/hub/__init__.py +166 -0
- ultralytics/hub/auth.py +151 -0
- ultralytics/hub/google/__init__.py +174 -0
- ultralytics/hub/session.py +422 -0
- ultralytics/hub/utils.py +162 -0
- ultralytics/models/__init__.py +9 -0
- ultralytics/models/fastsam/__init__.py +7 -0
- ultralytics/models/fastsam/model.py +79 -0
- ultralytics/models/fastsam/predict.py +169 -0
- ultralytics/models/fastsam/utils.py +23 -0
- ultralytics/models/fastsam/val.py +38 -0
- ultralytics/models/nas/__init__.py +7 -0
- ultralytics/models/nas/model.py +98 -0
- ultralytics/models/nas/predict.py +56 -0
- ultralytics/models/nas/val.py +38 -0
- ultralytics/models/rtdetr/__init__.py +7 -0
- ultralytics/models/rtdetr/model.py +63 -0
- ultralytics/models/rtdetr/predict.py +88 -0
- ultralytics/models/rtdetr/train.py +89 -0
- ultralytics/models/rtdetr/val.py +216 -0
- ultralytics/models/sam/__init__.py +25 -0
- ultralytics/models/sam/amg.py +275 -0
- ultralytics/models/sam/build.py +365 -0
- ultralytics/models/sam/build_sam3.py +377 -0
- ultralytics/models/sam/model.py +169 -0
- ultralytics/models/sam/modules/__init__.py +1 -0
- ultralytics/models/sam/modules/blocks.py +1067 -0
- ultralytics/models/sam/modules/decoders.py +495 -0
- ultralytics/models/sam/modules/encoders.py +794 -0
- ultralytics/models/sam/modules/memory_attention.py +298 -0
- ultralytics/models/sam/modules/sam.py +1160 -0
- ultralytics/models/sam/modules/tiny_encoder.py +979 -0
- ultralytics/models/sam/modules/transformer.py +344 -0
- ultralytics/models/sam/modules/utils.py +512 -0
- ultralytics/models/sam/predict.py +3940 -0
- ultralytics/models/sam/sam3/__init__.py +3 -0
- ultralytics/models/sam/sam3/decoder.py +546 -0
- ultralytics/models/sam/sam3/encoder.py +529 -0
- ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
- ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
- ultralytics/models/sam/sam3/model_misc.py +199 -0
- ultralytics/models/sam/sam3/necks.py +129 -0
- ultralytics/models/sam/sam3/sam3_image.py +339 -0
- ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
- ultralytics/models/sam/sam3/vitdet.py +547 -0
- ultralytics/models/sam/sam3/vl_combiner.py +160 -0
- ultralytics/models/utils/__init__.py +1 -0
- ultralytics/models/utils/loss.py +466 -0
- ultralytics/models/utils/ops.py +315 -0
- ultralytics/models/yolo/__init__.py +7 -0
- ultralytics/models/yolo/classify/__init__.py +7 -0
- ultralytics/models/yolo/classify/predict.py +90 -0
- ultralytics/models/yolo/classify/train.py +202 -0
- ultralytics/models/yolo/classify/val.py +216 -0
- ultralytics/models/yolo/detect/__init__.py +7 -0
- ultralytics/models/yolo/detect/predict.py +122 -0
- ultralytics/models/yolo/detect/train.py +227 -0
- ultralytics/models/yolo/detect/val.py +507 -0
- ultralytics/models/yolo/model.py +430 -0
- ultralytics/models/yolo/obb/__init__.py +7 -0
- ultralytics/models/yolo/obb/predict.py +56 -0
- ultralytics/models/yolo/obb/train.py +79 -0
- ultralytics/models/yolo/obb/val.py +302 -0
- ultralytics/models/yolo/pose/__init__.py +7 -0
- ultralytics/models/yolo/pose/predict.py +65 -0
- ultralytics/models/yolo/pose/train.py +110 -0
- ultralytics/models/yolo/pose/val.py +248 -0
- ultralytics/models/yolo/segment/__init__.py +7 -0
- ultralytics/models/yolo/segment/predict.py +109 -0
- ultralytics/models/yolo/segment/train.py +69 -0
- ultralytics/models/yolo/segment/val.py +307 -0
- ultralytics/models/yolo/world/__init__.py +5 -0
- ultralytics/models/yolo/world/train.py +173 -0
- ultralytics/models/yolo/world/train_world.py +178 -0
- ultralytics/models/yolo/yoloe/__init__.py +22 -0
- ultralytics/models/yolo/yoloe/predict.py +162 -0
- ultralytics/models/yolo/yoloe/train.py +287 -0
- ultralytics/models/yolo/yoloe/train_seg.py +122 -0
- ultralytics/models/yolo/yoloe/val.py +206 -0
- ultralytics/nn/__init__.py +27 -0
- ultralytics/nn/autobackend.py +958 -0
- ultralytics/nn/modules/__init__.py +182 -0
- ultralytics/nn/modules/activation.py +54 -0
- ultralytics/nn/modules/block.py +1947 -0
- ultralytics/nn/modules/conv.py +669 -0
- ultralytics/nn/modules/head.py +1183 -0
- ultralytics/nn/modules/transformer.py +793 -0
- ultralytics/nn/modules/utils.py +159 -0
- ultralytics/nn/tasks.py +1768 -0
- ultralytics/nn/text_model.py +356 -0
- ultralytics/py.typed +1 -0
- ultralytics/solutions/__init__.py +41 -0
- ultralytics/solutions/ai_gym.py +108 -0
- ultralytics/solutions/analytics.py +264 -0
- ultralytics/solutions/config.py +107 -0
- ultralytics/solutions/distance_calculation.py +123 -0
- ultralytics/solutions/heatmap.py +125 -0
- ultralytics/solutions/instance_segmentation.py +86 -0
- ultralytics/solutions/object_blurrer.py +89 -0
- ultralytics/solutions/object_counter.py +190 -0
- ultralytics/solutions/object_cropper.py +87 -0
- ultralytics/solutions/parking_management.py +280 -0
- ultralytics/solutions/queue_management.py +93 -0
- ultralytics/solutions/region_counter.py +133 -0
- ultralytics/solutions/security_alarm.py +151 -0
- ultralytics/solutions/similarity_search.py +219 -0
- ultralytics/solutions/solutions.py +828 -0
- ultralytics/solutions/speed_estimation.py +114 -0
- ultralytics/solutions/streamlit_inference.py +260 -0
- ultralytics/solutions/templates/similarity-search.html +156 -0
- ultralytics/solutions/trackzone.py +88 -0
- ultralytics/solutions/vision_eye.py +67 -0
- ultralytics/trackers/__init__.py +7 -0
- ultralytics/trackers/basetrack.py +115 -0
- ultralytics/trackers/bot_sort.py +257 -0
- ultralytics/trackers/byte_tracker.py +469 -0
- ultralytics/trackers/track.py +116 -0
- ultralytics/trackers/utils/__init__.py +1 -0
- ultralytics/trackers/utils/gmc.py +339 -0
- ultralytics/trackers/utils/kalman_filter.py +482 -0
- ultralytics/trackers/utils/matching.py +154 -0
- ultralytics/utils/__init__.py +1450 -0
- ultralytics/utils/autobatch.py +118 -0
- ultralytics/utils/autodevice.py +205 -0
- ultralytics/utils/benchmarks.py +728 -0
- ultralytics/utils/callbacks/__init__.py +5 -0
- ultralytics/utils/callbacks/base.py +233 -0
- ultralytics/utils/callbacks/clearml.py +146 -0
- ultralytics/utils/callbacks/comet.py +625 -0
- ultralytics/utils/callbacks/dvc.py +197 -0
- ultralytics/utils/callbacks/hub.py +110 -0
- ultralytics/utils/callbacks/mlflow.py +134 -0
- ultralytics/utils/callbacks/neptune.py +126 -0
- ultralytics/utils/callbacks/platform.py +313 -0
- ultralytics/utils/callbacks/raytune.py +42 -0
- ultralytics/utils/callbacks/tensorboard.py +123 -0
- ultralytics/utils/callbacks/wb.py +188 -0
- ultralytics/utils/checks.py +1006 -0
- ultralytics/utils/cpu.py +85 -0
- ultralytics/utils/dist.py +123 -0
- ultralytics/utils/downloads.py +529 -0
- ultralytics/utils/errors.py +35 -0
- ultralytics/utils/events.py +113 -0
- ultralytics/utils/export/__init__.py +7 -0
- ultralytics/utils/export/engine.py +237 -0
- ultralytics/utils/export/imx.py +315 -0
- ultralytics/utils/export/tensorflow.py +231 -0
- ultralytics/utils/files.py +219 -0
- ultralytics/utils/git.py +137 -0
- ultralytics/utils/instance.py +484 -0
- ultralytics/utils/logger.py +501 -0
- ultralytics/utils/loss.py +849 -0
- ultralytics/utils/metrics.py +1563 -0
- ultralytics/utils/nms.py +337 -0
- ultralytics/utils/ops.py +664 -0
- ultralytics/utils/patches.py +201 -0
- ultralytics/utils/plotting.py +1045 -0
- ultralytics/utils/tal.py +403 -0
- ultralytics/utils/torch_utils.py +984 -0
- ultralytics/utils/tqdm.py +440 -0
- ultralytics/utils/triton.py +112 -0
- ultralytics/utils/tuner.py +160 -0
- ultralytics_opencv_headless-8.3.246.dist-info/METADATA +374 -0
- ultralytics_opencv_headless-8.3.246.dist-info/RECORD +298 -0
- ultralytics_opencv_headless-8.3.246.dist-info/WHEEL +5 -0
- ultralytics_opencv_headless-8.3.246.dist-info/entry_points.txt +3 -0
- ultralytics_opencv_headless-8.3.246.dist-info/licenses/LICENSE +661 -0
- ultralytics_opencv_headless-8.3.246.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
|
+
|
|
3
|
+
# Objects365 dataset https://www.objects365.org/ by Megvii
|
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/detect/objects365/
|
|
5
|
+
# Example usage: yolo train data=Objects365.yaml
|
|
6
|
+
# parent
|
|
7
|
+
# ├── ultralytics
|
|
8
|
+
# └── datasets
|
|
9
|
+
# └── Objects365 ← downloads here (712 GB = 367G data + 345G zips)
|
|
10
|
+
|
|
11
|
+
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
|
12
|
+
path: Objects365 # dataset root dir
|
|
13
|
+
train: images/train # train images (relative to 'path') 1742289 images
|
|
14
|
+
val: images/val # val images (relative to 'path') 80000 images
|
|
15
|
+
test: # test images (optional)
|
|
16
|
+
|
|
17
|
+
# Classes
|
|
18
|
+
names:
|
|
19
|
+
0: Person
|
|
20
|
+
1: Sneakers
|
|
21
|
+
2: Chair
|
|
22
|
+
3: Other Shoes
|
|
23
|
+
4: Hat
|
|
24
|
+
5: Car
|
|
25
|
+
6: Lamp
|
|
26
|
+
7: Glasses
|
|
27
|
+
8: Bottle
|
|
28
|
+
9: Desk
|
|
29
|
+
10: Cup
|
|
30
|
+
11: Street Lights
|
|
31
|
+
12: Cabinet/shelf
|
|
32
|
+
13: Handbag/Satchel
|
|
33
|
+
14: Bracelet
|
|
34
|
+
15: Plate
|
|
35
|
+
16: Picture/Frame
|
|
36
|
+
17: Helmet
|
|
37
|
+
18: Book
|
|
38
|
+
19: Gloves
|
|
39
|
+
20: Storage box
|
|
40
|
+
21: Boat
|
|
41
|
+
22: Leather Shoes
|
|
42
|
+
23: Flower
|
|
43
|
+
24: Bench
|
|
44
|
+
25: Potted Plant
|
|
45
|
+
26: Bowl/Basin
|
|
46
|
+
27: Flag
|
|
47
|
+
28: Pillow
|
|
48
|
+
29: Boots
|
|
49
|
+
30: Vase
|
|
50
|
+
31: Microphone
|
|
51
|
+
32: Necklace
|
|
52
|
+
33: Ring
|
|
53
|
+
34: SUV
|
|
54
|
+
35: Wine Glass
|
|
55
|
+
36: Belt
|
|
56
|
+
37: Monitor/TV
|
|
57
|
+
38: Backpack
|
|
58
|
+
39: Umbrella
|
|
59
|
+
40: Traffic Light
|
|
60
|
+
41: Speaker
|
|
61
|
+
42: Watch
|
|
62
|
+
43: Tie
|
|
63
|
+
44: Trash bin Can
|
|
64
|
+
45: Slippers
|
|
65
|
+
46: Bicycle
|
|
66
|
+
47: Stool
|
|
67
|
+
48: Barrel/bucket
|
|
68
|
+
49: Van
|
|
69
|
+
50: Couch
|
|
70
|
+
51: Sandals
|
|
71
|
+
52: Basket
|
|
72
|
+
53: Drum
|
|
73
|
+
54: Pen/Pencil
|
|
74
|
+
55: Bus
|
|
75
|
+
56: Wild Bird
|
|
76
|
+
57: High Heels
|
|
77
|
+
58: Motorcycle
|
|
78
|
+
59: Guitar
|
|
79
|
+
60: Carpet
|
|
80
|
+
61: Cell Phone
|
|
81
|
+
62: Bread
|
|
82
|
+
63: Camera
|
|
83
|
+
64: Canned
|
|
84
|
+
65: Truck
|
|
85
|
+
66: Traffic cone
|
|
86
|
+
67: Cymbal
|
|
87
|
+
68: Lifesaver
|
|
88
|
+
69: Towel
|
|
89
|
+
70: Stuffed Toy
|
|
90
|
+
71: Candle
|
|
91
|
+
72: Sailboat
|
|
92
|
+
73: Laptop
|
|
93
|
+
74: Awning
|
|
94
|
+
75: Bed
|
|
95
|
+
76: Faucet
|
|
96
|
+
77: Tent
|
|
97
|
+
78: Horse
|
|
98
|
+
79: Mirror
|
|
99
|
+
80: Power outlet
|
|
100
|
+
81: Sink
|
|
101
|
+
82: Apple
|
|
102
|
+
83: Air Conditioner
|
|
103
|
+
84: Knife
|
|
104
|
+
85: Hockey Stick
|
|
105
|
+
86: Paddle
|
|
106
|
+
87: Pickup Truck
|
|
107
|
+
88: Fork
|
|
108
|
+
89: Traffic Sign
|
|
109
|
+
90: Balloon
|
|
110
|
+
91: Tripod
|
|
111
|
+
92: Dog
|
|
112
|
+
93: Spoon
|
|
113
|
+
94: Clock
|
|
114
|
+
95: Pot
|
|
115
|
+
96: Cow
|
|
116
|
+
97: Cake
|
|
117
|
+
98: Dining Table
|
|
118
|
+
99: Sheep
|
|
119
|
+
100: Hanger
|
|
120
|
+
101: Blackboard/Whiteboard
|
|
121
|
+
102: Napkin
|
|
122
|
+
103: Other Fish
|
|
123
|
+
104: Orange/Tangerine
|
|
124
|
+
105: Toiletry
|
|
125
|
+
106: Keyboard
|
|
126
|
+
107: Tomato
|
|
127
|
+
108: Lantern
|
|
128
|
+
109: Machinery Vehicle
|
|
129
|
+
110: Fan
|
|
130
|
+
111: Green Vegetables
|
|
131
|
+
112: Banana
|
|
132
|
+
113: Baseball Glove
|
|
133
|
+
114: Airplane
|
|
134
|
+
115: Mouse
|
|
135
|
+
116: Train
|
|
136
|
+
117: Pumpkin
|
|
137
|
+
118: Soccer
|
|
138
|
+
119: Skiboard
|
|
139
|
+
120: Luggage
|
|
140
|
+
121: Nightstand
|
|
141
|
+
122: Tea pot
|
|
142
|
+
123: Telephone
|
|
143
|
+
124: Trolley
|
|
144
|
+
125: Head Phone
|
|
145
|
+
126: Sports Car
|
|
146
|
+
127: Stop Sign
|
|
147
|
+
128: Dessert
|
|
148
|
+
129: Scooter
|
|
149
|
+
130: Stroller
|
|
150
|
+
131: Crane
|
|
151
|
+
132: Remote
|
|
152
|
+
133: Refrigerator
|
|
153
|
+
134: Oven
|
|
154
|
+
135: Lemon
|
|
155
|
+
136: Duck
|
|
156
|
+
137: Baseball Bat
|
|
157
|
+
138: Surveillance Camera
|
|
158
|
+
139: Cat
|
|
159
|
+
140: Jug
|
|
160
|
+
141: Broccoli
|
|
161
|
+
142: Piano
|
|
162
|
+
143: Pizza
|
|
163
|
+
144: Elephant
|
|
164
|
+
145: Skateboard
|
|
165
|
+
146: Surfboard
|
|
166
|
+
147: Gun
|
|
167
|
+
148: Skating and Skiing shoes
|
|
168
|
+
149: Gas stove
|
|
169
|
+
150: Donut
|
|
170
|
+
151: Bow Tie
|
|
171
|
+
152: Carrot
|
|
172
|
+
153: Toilet
|
|
173
|
+
154: Kite
|
|
174
|
+
155: Strawberry
|
|
175
|
+
156: Other Balls
|
|
176
|
+
157: Shovel
|
|
177
|
+
158: Pepper
|
|
178
|
+
159: Computer Box
|
|
179
|
+
160: Toilet Paper
|
|
180
|
+
161: Cleaning Products
|
|
181
|
+
162: Chopsticks
|
|
182
|
+
163: Microwave
|
|
183
|
+
164: Pigeon
|
|
184
|
+
165: Baseball
|
|
185
|
+
166: Cutting/chopping Board
|
|
186
|
+
167: Coffee Table
|
|
187
|
+
168: Side Table
|
|
188
|
+
169: Scissors
|
|
189
|
+
170: Marker
|
|
190
|
+
171: Pie
|
|
191
|
+
172: Ladder
|
|
192
|
+
173: Snowboard
|
|
193
|
+
174: Cookies
|
|
194
|
+
175: Radiator
|
|
195
|
+
176: Fire Hydrant
|
|
196
|
+
177: Basketball
|
|
197
|
+
178: Zebra
|
|
198
|
+
179: Grape
|
|
199
|
+
180: Giraffe
|
|
200
|
+
181: Potato
|
|
201
|
+
182: Sausage
|
|
202
|
+
183: Tricycle
|
|
203
|
+
184: Violin
|
|
204
|
+
185: Egg
|
|
205
|
+
186: Fire Extinguisher
|
|
206
|
+
187: Candy
|
|
207
|
+
188: Fire Truck
|
|
208
|
+
189: Billiards
|
|
209
|
+
190: Converter
|
|
210
|
+
191: Bathtub
|
|
211
|
+
192: Wheelchair
|
|
212
|
+
193: Golf Club
|
|
213
|
+
194: Briefcase
|
|
214
|
+
195: Cucumber
|
|
215
|
+
196: Cigar/Cigarette
|
|
216
|
+
197: Paint Brush
|
|
217
|
+
198: Pear
|
|
218
|
+
199: Heavy Truck
|
|
219
|
+
200: Hamburger
|
|
220
|
+
201: Extractor
|
|
221
|
+
202: Extension Cord
|
|
222
|
+
203: Tong
|
|
223
|
+
204: Tennis Racket
|
|
224
|
+
205: Folder
|
|
225
|
+
206: American Football
|
|
226
|
+
207: earphone
|
|
227
|
+
208: Mask
|
|
228
|
+
209: Kettle
|
|
229
|
+
210: Tennis
|
|
230
|
+
211: Ship
|
|
231
|
+
212: Swing
|
|
232
|
+
213: Coffee Machine
|
|
233
|
+
214: Slide
|
|
234
|
+
215: Carriage
|
|
235
|
+
216: Onion
|
|
236
|
+
217: Green beans
|
|
237
|
+
218: Projector
|
|
238
|
+
219: Frisbee
|
|
239
|
+
220: Washing Machine/Drying Machine
|
|
240
|
+
221: Chicken
|
|
241
|
+
222: Printer
|
|
242
|
+
223: Watermelon
|
|
243
|
+
224: Saxophone
|
|
244
|
+
225: Tissue
|
|
245
|
+
226: Toothbrush
|
|
246
|
+
227: Ice cream
|
|
247
|
+
228: Hot-air balloon
|
|
248
|
+
229: Cello
|
|
249
|
+
230: French Fries
|
|
250
|
+
231: Scale
|
|
251
|
+
232: Trophy
|
|
252
|
+
233: Cabbage
|
|
253
|
+
234: Hot dog
|
|
254
|
+
235: Blender
|
|
255
|
+
236: Peach
|
|
256
|
+
237: Rice
|
|
257
|
+
238: Wallet/Purse
|
|
258
|
+
239: Volleyball
|
|
259
|
+
240: Deer
|
|
260
|
+
241: Goose
|
|
261
|
+
242: Tape
|
|
262
|
+
243: Tablet
|
|
263
|
+
244: Cosmetics
|
|
264
|
+
245: Trumpet
|
|
265
|
+
246: Pineapple
|
|
266
|
+
247: Golf Ball
|
|
267
|
+
248: Ambulance
|
|
268
|
+
249: Parking meter
|
|
269
|
+
250: Mango
|
|
270
|
+
251: Key
|
|
271
|
+
252: Hurdle
|
|
272
|
+
253: Fishing Rod
|
|
273
|
+
254: Medal
|
|
274
|
+
255: Flute
|
|
275
|
+
256: Brush
|
|
276
|
+
257: Penguin
|
|
277
|
+
258: Megaphone
|
|
278
|
+
259: Corn
|
|
279
|
+
260: Lettuce
|
|
280
|
+
261: Garlic
|
|
281
|
+
262: Swan
|
|
282
|
+
263: Helicopter
|
|
283
|
+
264: Green Onion
|
|
284
|
+
265: Sandwich
|
|
285
|
+
266: Nuts
|
|
286
|
+
267: Speed Limit Sign
|
|
287
|
+
268: Induction Cooker
|
|
288
|
+
269: Broom
|
|
289
|
+
270: Trombone
|
|
290
|
+
271: Plum
|
|
291
|
+
272: Rickshaw
|
|
292
|
+
273: Goldfish
|
|
293
|
+
274: Kiwi fruit
|
|
294
|
+
275: Router/modem
|
|
295
|
+
276: Poker Card
|
|
296
|
+
277: Toaster
|
|
297
|
+
278: Shrimp
|
|
298
|
+
279: Sushi
|
|
299
|
+
280: Cheese
|
|
300
|
+
281: Notepaper
|
|
301
|
+
282: Cherry
|
|
302
|
+
283: Pliers
|
|
303
|
+
284: CD
|
|
304
|
+
285: Pasta
|
|
305
|
+
286: Hammer
|
|
306
|
+
287: Cue
|
|
307
|
+
288: Avocado
|
|
308
|
+
289: Hami melon
|
|
309
|
+
290: Flask
|
|
310
|
+
291: Mushroom
|
|
311
|
+
292: Screwdriver
|
|
312
|
+
293: Soap
|
|
313
|
+
294: Recorder
|
|
314
|
+
295: Bear
|
|
315
|
+
296: Eggplant
|
|
316
|
+
297: Board Eraser
|
|
317
|
+
298: Coconut
|
|
318
|
+
299: Tape Measure/Ruler
|
|
319
|
+
300: Pig
|
|
320
|
+
301: Showerhead
|
|
321
|
+
302: Globe
|
|
322
|
+
303: Chips
|
|
323
|
+
304: Steak
|
|
324
|
+
305: Crosswalk Sign
|
|
325
|
+
306: Stapler
|
|
326
|
+
307: Camel
|
|
327
|
+
308: Formula 1
|
|
328
|
+
309: Pomegranate
|
|
329
|
+
310: Dishwasher
|
|
330
|
+
311: Crab
|
|
331
|
+
312: Hoverboard
|
|
332
|
+
313: Meatball
|
|
333
|
+
314: Rice Cooker
|
|
334
|
+
315: Tuba
|
|
335
|
+
316: Calculator
|
|
336
|
+
317: Papaya
|
|
337
|
+
318: Antelope
|
|
338
|
+
319: Parrot
|
|
339
|
+
320: Seal
|
|
340
|
+
321: Butterfly
|
|
341
|
+
322: Dumbbell
|
|
342
|
+
323: Donkey
|
|
343
|
+
324: Lion
|
|
344
|
+
325: Urinal
|
|
345
|
+
326: Dolphin
|
|
346
|
+
327: Electric Drill
|
|
347
|
+
328: Hair Dryer
|
|
348
|
+
329: Egg tart
|
|
349
|
+
330: Jellyfish
|
|
350
|
+
331: Treadmill
|
|
351
|
+
332: Lighter
|
|
352
|
+
333: Grapefruit
|
|
353
|
+
334: Game board
|
|
354
|
+
335: Mop
|
|
355
|
+
336: Radish
|
|
356
|
+
337: Baozi
|
|
357
|
+
338: Target
|
|
358
|
+
339: French
|
|
359
|
+
340: Spring Rolls
|
|
360
|
+
341: Monkey
|
|
361
|
+
342: Rabbit
|
|
362
|
+
343: Pencil Case
|
|
363
|
+
344: Yak
|
|
364
|
+
345: Red Cabbage
|
|
365
|
+
346: Binoculars
|
|
366
|
+
347: Asparagus
|
|
367
|
+
348: Barbell
|
|
368
|
+
349: Scallop
|
|
369
|
+
350: Noddles
|
|
370
|
+
351: Comb
|
|
371
|
+
352: Dumpling
|
|
372
|
+
353: Oyster
|
|
373
|
+
354: Table Tennis paddle
|
|
374
|
+
355: Cosmetics Brush/Eyeliner Pencil
|
|
375
|
+
356: Chainsaw
|
|
376
|
+
357: Eraser
|
|
377
|
+
358: Lobster
|
|
378
|
+
359: Durian
|
|
379
|
+
360: Okra
|
|
380
|
+
361: Lipstick
|
|
381
|
+
362: Cosmetics Mirror
|
|
382
|
+
363: Curling
|
|
383
|
+
364: Table Tennis
|
|
384
|
+
|
|
385
|
+
# Download script/URL (optional) ---------------------------------------------------------------------------------------
|
|
386
|
+
download: |
|
|
387
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
388
|
+
from pathlib import Path
|
|
389
|
+
|
|
390
|
+
import numpy as np
|
|
391
|
+
|
|
392
|
+
from ultralytics.utils import TQDM
|
|
393
|
+
from ultralytics.utils.checks import check_requirements
|
|
394
|
+
from ultralytics.utils.downloads import download
|
|
395
|
+
from ultralytics.utils.ops import xyxy2xywhn
|
|
396
|
+
|
|
397
|
+
check_requirements("faster-coco-eval")
|
|
398
|
+
from faster_coco_eval import COCO
|
|
399
|
+
|
|
400
|
+
# Train, Val Splits
|
|
401
|
+
dir = Path(yaml["path"])
|
|
402
|
+
for split, patches in [("train", 50 + 1), ("val", 43 + 1)]:
|
|
403
|
+
print(f"Processing {split} in {patches} patches ...")
|
|
404
|
+
images, labels = dir / "images" / split, dir / "labels" / split
|
|
405
|
+
images.mkdir(parents=True, exist_ok=True)
|
|
406
|
+
labels.mkdir(parents=True, exist_ok=True)
|
|
407
|
+
|
|
408
|
+
# Download
|
|
409
|
+
url = f"https://dorc.ks3-cn-beijing.ksyun.com/data-set/2020Objects365%E6%95%B0%E6%8D%AE%E9%9B%86/{split}/"
|
|
410
|
+
if split == "train":
|
|
411
|
+
download([f"{url}zhiyuan_objv2_{split}.tar.gz"], dir=dir) # annotations json
|
|
412
|
+
download([f"{url}patch{i}.tar.gz" for i in range(patches)], dir=images, threads=17) # 51 patches / 17 threads = 3
|
|
413
|
+
elif split == "val":
|
|
414
|
+
download([f"{url}zhiyuan_objv2_{split}.json"], dir=dir) # annotations json
|
|
415
|
+
download([f"{url}images/v1/patch{i}.tar.gz" for i in range(15 + 1)], dir=images, threads=16)
|
|
416
|
+
download([f"{url}images/v2/patch{i}.tar.gz" for i in range(16, patches)], dir=images, threads=16)
|
|
417
|
+
|
|
418
|
+
# Move
|
|
419
|
+
files = list(images.rglob("*.jpg"))
|
|
420
|
+
with ThreadPoolExecutor(max_workers=16) as executor:
|
|
421
|
+
list(TQDM(executor.map(lambda f: f.rename(images / f.name), files), total=len(files), desc=f"Moving {split} images"))
|
|
422
|
+
|
|
423
|
+
# Labels
|
|
424
|
+
coco = COCO(dir / f"zhiyuan_objv2_{split}.json")
|
|
425
|
+
names = [x["name"] for x in coco.loadCats(coco.getCatIds())]
|
|
426
|
+
for cid, cat in enumerate(names):
|
|
427
|
+
catIds = coco.getCatIds(catNms=[cat])
|
|
428
|
+
imgIds = coco.getImgIds(catIds=catIds)
|
|
429
|
+
|
|
430
|
+
def process_annotation(im):
|
|
431
|
+
"""Process and write annotations for a single image."""
|
|
432
|
+
try:
|
|
433
|
+
width, height = im["width"], im["height"]
|
|
434
|
+
path = Path(im["file_name"])
|
|
435
|
+
with open(labels / path.with_suffix(".txt").name, "a", encoding="utf-8") as file:
|
|
436
|
+
annIds = coco.getAnnIds(imgIds=im["id"], catIds=catIds, iscrowd=None)
|
|
437
|
+
for a in coco.loadAnns(annIds):
|
|
438
|
+
x, y, w, h = a["bbox"] # bounding box in xywh (xy top-left corner)
|
|
439
|
+
xyxy = np.array([x, y, x + w, y + h])[None] # pixels(1,4)
|
|
440
|
+
x, y, w, h = xyxy2xywhn(xyxy, w=width, h=height, clip=True)[0] # normalized and clipped
|
|
441
|
+
file.write(f"{cid} {x:.5f} {y:.5f} {w:.5f} {h:.5f}\n")
|
|
442
|
+
except Exception as e:
|
|
443
|
+
print(e)
|
|
444
|
+
|
|
445
|
+
images_list = coco.loadImgs(imgIds)
|
|
446
|
+
with ThreadPoolExecutor(max_workers=16) as executor:
|
|
447
|
+
list(TQDM(executor.map(process_annotation, images_list), total=len(images_list), desc=f"Class {cid + 1}/{len(names)} {cat}"))
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
|
+
|
|
3
|
+
# SKU-110K retail items dataset https://github.com/eg4000/SKU110K_CVPR19 by Trax Retail
|
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/detect/sku-110k/
|
|
5
|
+
# Example usage: yolo train data=SKU-110K.yaml
|
|
6
|
+
# parent
|
|
7
|
+
# ├── ultralytics
|
|
8
|
+
# └── datasets
|
|
9
|
+
# └── SKU-110K ← downloads here (13.6 GB)
|
|
10
|
+
|
|
11
|
+
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
|
12
|
+
path: SKU-110K # dataset root dir
|
|
13
|
+
train: train.txt # train images (relative to 'path') 8219 images
|
|
14
|
+
val: val.txt # val images (relative to 'path') 588 images
|
|
15
|
+
test: test.txt # test images (optional) 2936 images
|
|
16
|
+
|
|
17
|
+
# Classes
|
|
18
|
+
names:
|
|
19
|
+
0: object
|
|
20
|
+
|
|
21
|
+
# Download script/URL (optional) ---------------------------------------------------------------------------------------
|
|
22
|
+
download: |
|
|
23
|
+
import shutil
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
import numpy as np
|
|
27
|
+
import polars as pl
|
|
28
|
+
|
|
29
|
+
from ultralytics.utils import TQDM
|
|
30
|
+
from ultralytics.utils.downloads import download
|
|
31
|
+
from ultralytics.utils.ops import xyxy2xywh
|
|
32
|
+
|
|
33
|
+
# Download
|
|
34
|
+
dir = Path(yaml["path"]) # dataset root dir
|
|
35
|
+
parent = Path(dir.parent) # download dir
|
|
36
|
+
urls = ["http://trax-geometry.s3.amazonaws.com/cvpr_challenge/SKU110K_fixed.tar.gz"]
|
|
37
|
+
download(urls, dir=parent)
|
|
38
|
+
|
|
39
|
+
# Rename directories
|
|
40
|
+
if dir.exists():
|
|
41
|
+
shutil.rmtree(dir)
|
|
42
|
+
(parent / "SKU110K_fixed").rename(dir) # rename dir
|
|
43
|
+
(dir / "labels").mkdir(parents=True, exist_ok=True) # create labels dir
|
|
44
|
+
|
|
45
|
+
# Convert labels
|
|
46
|
+
names = "image", "x1", "y1", "x2", "y2", "class", "image_width", "image_height" # column names
|
|
47
|
+
for d in "annotations_train.csv", "annotations_val.csv", "annotations_test.csv":
|
|
48
|
+
x = pl.read_csv(dir / "annotations" / d, has_header=False, new_columns=names, infer_schema_length=None).to_numpy() # annotations
|
|
49
|
+
images, unique_images = x[:, 0], np.unique(x[:, 0])
|
|
50
|
+
with open((dir / d).with_suffix(".txt").__str__().replace("annotations_", ""), "w", encoding="utf-8") as f:
|
|
51
|
+
f.writelines(f"./images/{s}\n" for s in unique_images)
|
|
52
|
+
for im in TQDM(unique_images, desc=f"Converting {dir / d}"):
|
|
53
|
+
cls = 0 # single-class dataset
|
|
54
|
+
with open((dir / "labels" / im).with_suffix(".txt"), "a", encoding="utf-8") as f:
|
|
55
|
+
for r in x[images == im]:
|
|
56
|
+
w, h = r[6], r[7] # image width, height
|
|
57
|
+
xywh = xyxy2xywh(np.array([[r[1] / w, r[2] / h, r[3] / w, r[4] / h]]))[0] # instance
|
|
58
|
+
f.write(f"{cls} {xywh[0]:.5f} {xywh[1]:.5f} {xywh[2]:.5f} {xywh[3]:.5f}\n") # write label
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
|
+
|
|
3
|
+
# PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC by University of Oxford
|
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/detect/voc/
|
|
5
|
+
# Example usage: yolo train data=VOC.yaml
|
|
6
|
+
# parent
|
|
7
|
+
# ├── ultralytics
|
|
8
|
+
# └── datasets
|
|
9
|
+
# └── VOC ← downloads here (2.8 GB)
|
|
10
|
+
|
|
11
|
+
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
|
12
|
+
path: VOC
|
|
13
|
+
train: # train images (relative to 'path') 16551 images
|
|
14
|
+
- images/train2012
|
|
15
|
+
- images/train2007
|
|
16
|
+
- images/val2012
|
|
17
|
+
- images/val2007
|
|
18
|
+
val: # val images (relative to 'path') 4952 images
|
|
19
|
+
- images/test2007
|
|
20
|
+
test: # test images (optional)
|
|
21
|
+
- images/test2007
|
|
22
|
+
|
|
23
|
+
# Classes
|
|
24
|
+
names:
|
|
25
|
+
0: aeroplane
|
|
26
|
+
1: bicycle
|
|
27
|
+
2: bird
|
|
28
|
+
3: boat
|
|
29
|
+
4: bottle
|
|
30
|
+
5: bus
|
|
31
|
+
6: car
|
|
32
|
+
7: cat
|
|
33
|
+
8: chair
|
|
34
|
+
9: cow
|
|
35
|
+
10: diningtable
|
|
36
|
+
11: dog
|
|
37
|
+
12: horse
|
|
38
|
+
13: motorbike
|
|
39
|
+
14: person
|
|
40
|
+
15: pottedplant
|
|
41
|
+
16: sheep
|
|
42
|
+
17: sofa
|
|
43
|
+
18: train
|
|
44
|
+
19: tvmonitor
|
|
45
|
+
|
|
46
|
+
# Download script/URL (optional) ---------------------------------------------------------------------------------------
|
|
47
|
+
download: |
|
|
48
|
+
import xml.etree.ElementTree as ET
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
|
|
51
|
+
from ultralytics.utils.downloads import download
|
|
52
|
+
from ultralytics.utils import ASSETS_URL, TQDM
|
|
53
|
+
|
|
54
|
+
def convert_label(path, lb_path, year, image_id):
|
|
55
|
+
"""Converts XML annotations from VOC format to YOLO format by extracting bounding boxes and class IDs."""
|
|
56
|
+
|
|
57
|
+
def convert_box(size, box):
|
|
58
|
+
dw, dh = 1.0 / size[0], 1.0 / size[1]
|
|
59
|
+
x, y, w, h = (box[0] + box[1]) / 2.0 - 1, (box[2] + box[3]) / 2.0 - 1, box[1] - box[0], box[3] - box[2]
|
|
60
|
+
return x * dw, y * dh, w * dw, h * dh
|
|
61
|
+
|
|
62
|
+
with open(path / f"VOC{year}/Annotations/{image_id}.xml") as in_file, open(lb_path, "w", encoding="utf-8") as out_file:
|
|
63
|
+
tree = ET.parse(in_file)
|
|
64
|
+
root = tree.getroot()
|
|
65
|
+
size = root.find("size")
|
|
66
|
+
w = int(size.find("width").text)
|
|
67
|
+
h = int(size.find("height").text)
|
|
68
|
+
|
|
69
|
+
names = list(yaml["names"].values()) # names list
|
|
70
|
+
for obj in root.iter("object"):
|
|
71
|
+
cls = obj.find("name").text
|
|
72
|
+
if cls in names and int(obj.find("difficult").text) != 1:
|
|
73
|
+
xmlbox = obj.find("bndbox")
|
|
74
|
+
bb = convert_box((w, h), [float(xmlbox.find(x).text) for x in ("xmin", "xmax", "ymin", "ymax")])
|
|
75
|
+
cls_id = names.index(cls) # class id
|
|
76
|
+
out_file.write(" ".join(str(a) for a in (cls_id, *bb)) + "\n")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# Download
|
|
80
|
+
dir = Path(yaml["path"]) # dataset root dir
|
|
81
|
+
urls = [
|
|
82
|
+
f"{ASSETS_URL}/VOCtrainval_06-Nov-2007.zip", # 446MB, 5012 images
|
|
83
|
+
f"{ASSETS_URL}/VOCtest_06-Nov-2007.zip", # 438MB, 4953 images
|
|
84
|
+
f"{ASSETS_URL}/VOCtrainval_11-May-2012.zip", # 1.95GB, 17126 images
|
|
85
|
+
]
|
|
86
|
+
download(urls, dir=dir / "images", threads=3, exist_ok=True) # download and unzip over existing (required)
|
|
87
|
+
|
|
88
|
+
# Convert
|
|
89
|
+
path = dir / "images/VOCdevkit"
|
|
90
|
+
for year, image_set in ("2012", "train"), ("2012", "val"), ("2007", "train"), ("2007", "val"), ("2007", "test"):
|
|
91
|
+
imgs_path = dir / "images" / f"{image_set}{year}"
|
|
92
|
+
lbs_path = dir / "labels" / f"{image_set}{year}"
|
|
93
|
+
imgs_path.mkdir(exist_ok=True, parents=True)
|
|
94
|
+
lbs_path.mkdir(exist_ok=True, parents=True)
|
|
95
|
+
|
|
96
|
+
with open(path / f"VOC{year}/ImageSets/Main/{image_set}.txt") as f:
|
|
97
|
+
image_ids = f.read().strip().split()
|
|
98
|
+
for id in TQDM(image_ids, desc=f"{image_set}{year}"):
|
|
99
|
+
f = path / f"VOC{year}/JPEGImages/{id}.jpg" # old img path
|
|
100
|
+
lb_path = (lbs_path / f.name).with_suffix(".txt") # new label path
|
|
101
|
+
f.rename(imgs_path / f.name) # move image
|
|
102
|
+
convert_label(path, lb_path, year, id) # convert labels to YOLO format
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
|
+
|
|
3
|
+
# VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset by Tianjin University
|
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/detect/visdrone/
|
|
5
|
+
# Example usage: yolo train data=VisDrone.yaml
|
|
6
|
+
# parent
|
|
7
|
+
# ├── ultralytics
|
|
8
|
+
# └── datasets
|
|
9
|
+
# └── VisDrone ← downloads here (2.3 GB)
|
|
10
|
+
|
|
11
|
+
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
|
12
|
+
path: VisDrone # dataset root dir
|
|
13
|
+
train: images/train # train images (relative to 'path') 6471 images
|
|
14
|
+
val: images/val # val images (relative to 'path') 548 images
|
|
15
|
+
test: images/test # test-dev images (optional) 1610 images
|
|
16
|
+
|
|
17
|
+
# Classes
|
|
18
|
+
names:
|
|
19
|
+
0: pedestrian
|
|
20
|
+
1: people
|
|
21
|
+
2: bicycle
|
|
22
|
+
3: car
|
|
23
|
+
4: van
|
|
24
|
+
5: truck
|
|
25
|
+
6: tricycle
|
|
26
|
+
7: awning-tricycle
|
|
27
|
+
8: bus
|
|
28
|
+
9: motor
|
|
29
|
+
|
|
30
|
+
# Download script/URL (optional) ---------------------------------------------------------------------------------------
|
|
31
|
+
download: |
|
|
32
|
+
import os
|
|
33
|
+
from pathlib import Path
|
|
34
|
+
import shutil
|
|
35
|
+
|
|
36
|
+
from ultralytics.utils.downloads import download
|
|
37
|
+
from ultralytics.utils import ASSETS_URL, TQDM
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def visdrone2yolo(dir, split, source_name=None):
|
|
41
|
+
"""Convert VisDrone annotations to YOLO format with images/{split} and labels/{split} structure."""
|
|
42
|
+
from PIL import Image
|
|
43
|
+
|
|
44
|
+
source_dir = dir / (source_name or f"VisDrone2019-DET-{split}")
|
|
45
|
+
images_dir = dir / "images" / split
|
|
46
|
+
labels_dir = dir / "labels" / split
|
|
47
|
+
labels_dir.mkdir(parents=True, exist_ok=True)
|
|
48
|
+
|
|
49
|
+
# Move images to new structure
|
|
50
|
+
if (source_images_dir := source_dir / "images").exists():
|
|
51
|
+
images_dir.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
for img in source_images_dir.glob("*.jpg"):
|
|
53
|
+
img.rename(images_dir / img.name)
|
|
54
|
+
|
|
55
|
+
for f in TQDM((source_dir / "annotations").glob("*.txt"), desc=f"Converting {split}"):
|
|
56
|
+
img_size = Image.open(images_dir / f.with_suffix(".jpg").name).size
|
|
57
|
+
dw, dh = 1.0 / img_size[0], 1.0 / img_size[1]
|
|
58
|
+
lines = []
|
|
59
|
+
|
|
60
|
+
with open(f, encoding="utf-8") as file:
|
|
61
|
+
for row in [x.split(",") for x in file.read().strip().splitlines()]:
|
|
62
|
+
if row[4] != "0": # Skip ignored regions
|
|
63
|
+
x, y, w, h = map(int, row[:4])
|
|
64
|
+
cls = int(row[5]) - 1
|
|
65
|
+
# Convert to YOLO format
|
|
66
|
+
x_center, y_center = (x + w / 2) * dw, (y + h / 2) * dh
|
|
67
|
+
w_norm, h_norm = w * dw, h * dh
|
|
68
|
+
lines.append(f"{cls} {x_center:.6f} {y_center:.6f} {w_norm:.6f} {h_norm:.6f}\n")
|
|
69
|
+
|
|
70
|
+
(labels_dir / f.name).write_text("".join(lines), encoding="utf-8")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# Download (ignores test-challenge split)
|
|
74
|
+
dir = Path(yaml["path"]) # dataset root dir
|
|
75
|
+
urls = [
|
|
76
|
+
f"{ASSETS_URL}/VisDrone2019-DET-train.zip",
|
|
77
|
+
f"{ASSETS_URL}/VisDrone2019-DET-val.zip",
|
|
78
|
+
f"{ASSETS_URL}/VisDrone2019-DET-test-dev.zip",
|
|
79
|
+
# f"{ASSETS_URL}/VisDrone2019-DET-test-challenge.zip",
|
|
80
|
+
]
|
|
81
|
+
download(urls, dir=dir, threads=4)
|
|
82
|
+
|
|
83
|
+
# Convert
|
|
84
|
+
splits = {"VisDrone2019-DET-train": "train", "VisDrone2019-DET-val": "val", "VisDrone2019-DET-test-dev": "test"}
|
|
85
|
+
for folder, split in splits.items():
|
|
86
|
+
visdrone2yolo(dir, split, folder) # convert VisDrone annotations to YOLO labels
|
|
87
|
+
shutil.rmtree(dir / folder) # cleanup original directory
|