You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/torchconnector/examples.md
+219Lines changed: 219 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -316,6 +316,225 @@ DCP.load(
316
316
317
317
```
318
318
319
+
## YOLO
320
+
321
+
OSS connector for AI/ML provides integration with popular YOLO frameworks for training object detection models directly from OSS storage.
322
+
323
+
### Training with Ultralytics
324
+
325
+
OSS connector for AI/ML provides integration with [Ultralytics](https://docs.ultralytics.com/) framework for training YOLO models directly from OSS storage.
326
+
327
+
#### Dataset Configuration
328
+
329
+
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. Two formats are supported:
330
+
331
+
**Format 1: Directory-based**
332
+
333
+
In this format, `train` and `val` specify directory prefixes containing the images. The connector will list all objects under these prefixes.
334
+
335
+
```yaml
336
+
path: oss://ossconnectorbucket/COCO_YOLO
337
+
train: images/train2017
338
+
val: images/val2017
339
+
340
+
nc: 80
341
+
342
+
names:
343
+
0: person
344
+
1: bicycle
345
+
2: car
346
+
# ... (class names continue)
347
+
```
348
+
349
+
**Expected OSS object layout:**
350
+
```
351
+
<bucket>/<base_key>/
352
+
images/
353
+
train2017/ ← ~118k images
354
+
val2017/ ← 5k images
355
+
labels/
356
+
train2017/ ← YOLO .txt annotations
357
+
val2017/
358
+
```
359
+
360
+
**Label path rule:** Images in `images/train2017/x.jpg` will automatically resolve to labels in `labels/train2017/x.txt`.
361
+
362
+
**Format 2: Manifest file-based**
363
+
364
+
In this format, `train` and `val` specify manifest files containing lists of image paths. This format is suitable for datasets with a large number of objects and repeated dataset loading, as it avoids the overhead of listing objects in OSS.
365
+
366
+
```yaml
367
+
path: oss://ossconnectorbucket/COCO_YOLO
368
+
train: images/train2017.txt
369
+
val: images/val2017.txt
370
+
371
+
nc: 80
372
+
373
+
names:
374
+
0: person
375
+
1: bicycle
376
+
2: car
377
+
# ... (class names continue)
378
+
```
379
+
380
+
**Manifest file format (`train2017.txt`):**
381
+
```
382
+
/bucket/COCO_YOLO/images/train2017/image001.jpg
383
+
/bucket/COCO_YOLO/images/train2017/image002.jpg
384
+
/bucket/COCO_YOLO/images/train2017/image003.jpg
385
+
```
386
+
387
+
Each line in the manifest file is a `/bucket/key` path. Lines starting with `/` are used as-is; other lines are joined with the manifest's directory prefix.
The `make_oss_trainer` function creates a custom trainer that enables Ultralytics to read training data directly from OSS. The trainer handles:
420
+
- Resolving OSS URIs from the YAML configuration
421
+
- Reading images and labels from OSS storage
422
+
- Supporting both directory-based and manifest file-based dataset configurations
423
+
424
+
### Training with MMDetection
425
+
426
+
OSS connector for AI/ML provides integration with [MMDetection](https://github.com/open-mmlab/mmdetection) framework for training object detection models directly from OSS storage.
427
+
428
+
#### Dataset Configuration
429
+
430
+
MMDetection uses COCO-format JSON annotation files. The dataset configuration is specified programmatically when building the MMEngine config, rather than through a YAML file.
0 commit comments