File size: 1,338 Bytes
33871a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Datasets-Structure

**(YOLOv8 format)**

The Yolov8 dataset for segmentation is usually structured as follows:
```
yolo_dataset/
β”‚
β”œβ”€β”€ train/
β”‚ β”œβ”€β”€ images/
β”‚ β”‚ └── πŸ–ΌοΈ img_n # Example image 
β”‚ β”‚
β”‚ └── labels/
β”‚   └── πŸ“„ img_n_labels.txt # Example labels file 
β”‚
β”œβ”€β”€ valid/
β”‚ β”‚ ... (similar)
β”‚
└── πŸ“„ data.yaml
```

Each ```img_x_labels.txt``` file contains multiple annotations (one per line) with corresponding class ID and segmentation coordinates:

`<class-index> <x1> <y1> <x2> <y2> ... <xn> <yn>`

The file `data.yaml` contains keys such as:
 - names (the class names)
 - nc (number or classes)
 - train (path/to/train/images/)
 - val (path/to/val/images/)


**(COCO Instance Segmentation format)**
```
coco_dataset/
β”‚
β”œβ”€β”€ train/
β”‚  β”œβ”€β”€ πŸ–ΌοΈ img_n # Example image 
β”‚  └── πŸ“„ annotations.json # The annotations json file
β”‚
└── valid/ 
   └── ... (similar)

```

The annotations json file contains a dictionary of lists:

- images (a list of dictionaries)
  - id - image ID
  - file_name 
  - height
  - width


- annotations (a list of dictionaries)
  - id
  - image_id
  - category_id
  - bbox 
  - area
  - segmentation (a segmentation polygon)
  - iscrowd

 
- categories (a list of dictionaries)
  - id
  - name