Dataset format mismatches between Ultralytics YOLOv8 training and Label Studio exported

I used Tensorflow before and am new to PyTorch and Ultralytics YOLOv8. I recently learnt to train (fine-tune) the YOLOv8 object detection model to fit my own dataset. However, the official documentation only shows how to train it in COCO8 format with YAML file. The dataset exported by Label Studio is only in JSON, not YAML (even exported as YOLO format!).

Then I tried to directly replace model.train(data="coco8.yaml", epochs=100, imgsz=640) with model.train(data="coco/result.json", epochs=100, imgsz=640). But no surprise, it not works.

So, I have 2 questions:

  1. Does YOLOv8 support other format of data to do fine-tuning? Then what’s the problem with YOLO and YOLOv8 OBB option in Label Studio?
  2. Can I export YAML file with COCO8 format in Label Studio?

Edit:

By looking through the example coco8.yaml file in their GitHub, I find the yaml file can be easily hard-coded manually. However, I still wonder how the dataset exported by Label Studio can be used, and why the problem of format interface exists.

Does YOLOv8 support other format of data to do fine-tuning?

No, Ultralytics YOLOv8 supports only datasets in the YOLO format, as described in the official documentation: for Object detection https://docs.ultralytics.com/datasets/detect/, for Oriented Bounding Box detection https://docs.ultralytics.com/datasets/obb/, and so on.

Then what’s the problem with YOLO and YOLOv8 OBB option in Label Studio?

As expected, the data exported in the YOLO format from Label Studio will have the following content: notes.json, classes.txt, images and labels folders. You still need to do some preprocessing to create a YOLO dataset from these files.

Can I export YAML file with COCO8 format in Label Studio?

The YAML file here is just a short text description of the YOLO dataset (dataset path and class list), you need to create it manually in this case.

  1. First, partition the images and their corresponding labels into train and validation sets so that you will have train and val folders with images and labels folders inside each of them.
  2. Create a new text file and describe your dataset in the following format:
# Train/val/test sets as 1) dir: path/to/imgs
path: "../datasets/mydataset" # dataset root dir
train: "train" # train folder (relative to 'path')
val: "val" # validation folder (relative to 'path')
test: # test folder (optional)

# Classes list
names:
    0: person
    1: bicycle
    2: car
  1. Rename this text file to mydataset.yaml. This is your YAML file which is absent in the original exported data from Label Studio.
  2. Create the dataset folder and put into it your train and val folders, as well as the mydataset.yaml file. You don’t need the json file or classes.txt file (dataset classes information is already in the .yaml file now)

After this preprocessing of the exported dataset, you can train the YOLOv8 model on it:

from ultralytics import YOLO

# Load a model
model = YOLO("yolov8n.pt")  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data="/path/to/mydataset.yaml", epochs=100, imgsz=640)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật