Day 52: Fine-tuning YOLO: dataset prep for person + garment classes
Teaching YOLO your garment classes
Pretrained YOLO knows 'person' but not 'saree' or 'kurta'. Fine-tuning adds your garment classes. First, the data: YOLO needs images plus label files, one .txt per image, each line class_id cx cy w h with coordinates normalized 0–1 relative to image size. Getting this format exactly right is where most YOLO training failures actually originate.
# customer_01.txt (alongside customer_01.jpg)
# class_id center_x center_y width height (all normalized 0-1)
0 0.512 0.480 0.230 0.760 # person
3 0.505 0.350 0.180 0.240 # shirt
1 0.500 0.700 0.160 0.300 # trouserspath: ./garment_dataset
train: images/train
val: images/val
names:
0: person
1: trousers
2: dress
3: shirt
4: saree
5: shoesSplit by person, label consistently
Day 38's rules carry over: split by *individual/photoshoot* so the same person doesn't appear in both train and val (leakage), and define ambiguous garment boundaries once and label them uniformly. Annotation tools (Roboflow, CVAT, Label Studio) export YOLO format directly — use one rather than writing label files by hand.
Key terms
- YOLO label format
- One text file per image; each line is class_id and normalized center-x, center-y, width, height.
- data.yaml
- A config file telling Ultralytics where the train/val images are and what the class names are.
- Annotation tool
- Software (Roboflow, CVAT, Label Studio) for drawing boxes and exporting labels in a chosen format.
In a YOLO label file, the bounding box coordinates are expressed how?