Darknet TXT

Folder structure

  • classes.yaml

  • images

    • train

      • image1.jpg

      • image2.jpg

      • image(N).jpg

    • valid

      • image3.jpg

      • image4.jpg

      • image(N+1).jpg

    • test

      • image5.jpg

      • image6.jpg

      • image(N+2).jpg

  • labels

    • train

      • image1.txt

      • image2.txt

      • image(N).txt

    • valid

      • image3.txt

      • image4.txt

      • image(N+1).txt

    • test

      • image5.txt

      • image6.txt

      • image(N+2).txt

The classes file

classes.yaml
train: ./images/train/
valid: ./images/valid/
test: ./images/test/

# number of classes
nc: 4

# classes
names: ['eye', 'nose', 'mouth', 'face']

The label file

Each line represents a bounding box.

The bounding box line is composed of the following 5 numbers in order.

  1. Class ID.

  2. (Top left point X) / (Image width).

  3. (Top left point Y) / (Image height).

  4. (Box width) / (Image width).

  5. (Box height) / (Image height).

einstein.jpg

einstein.txt
0 0.479492 0.688771 0.955609 0.5955
0 0.736516 0.247188 0.498875 0.476417
1 0.637063 0.732938 0.494125 0.510583
2 0.339438 0.418896 0.678875 0.7815
3 0.646836 0.132552 0.118047 0.096937

Last updated