Creating a custom yolox model using coco script

I want to train my custom yolox model and use it with opencv. I have two different folders for images, one is for training and one is for testing.

I have annotated both the training and the testing folder.

I am using labelme2coco script: GitHub - fcakyon/labelme2coco: A lightweight package for converting your labelme annotations into COCO object detection format.

And I copied file and executed it:

# import functions
from labelme2coco import get_coco_from_labelme_folder, save_json

# set labelme training data directory
labelme_train_folder = "tests/data/labelme_annot"

# set labelme validation data directory
labelme_val_folder = "tests/data/labelme_annot"

# set path for coco json to be saved
export_dir = "tests/data/"

# set category ID start value
category_id_start = 1

# create train coco object
train_coco = get_coco_from_labelme_folder(labelme_train_folder, category_id_start=category_id_start)

# export train coco json
save_json(train_coco.json, export_dir+"train.json")

# create val coco object
val_coco = get_coco_from_labelme_folder(labelme_val_folder, coco_category_list=train_coco.json_categories, category_id_start=category_id_start)

# export val coco json
save_json(val_coco.json, export_dir+"val.json")

which generated a test and val json file. Now I need to create a dataset file. I have ran labelme2coco path/to/labelme/dir which did generate the dataset file however my question is that am I supposed generate the training and val json files before I generate the dataset file or vice versa or it doesn’t matter?

And another question is when running labelme2coco path/to/labelme/dir, the directory is referring to the training images, NOT the validation images?

This is the forum for OpenCV.

What you do does not involve OpenCV.

You’d have better luck in a more appropriate forum.