Skip to content

Ikomia-hub/dataset_coco

Repository files navigation

Algorithm icon

dataset_coco


Stars Website GitHub
Discord community

Load any dataset in COCO format to Ikomia format. Then, any training algorithms from the Ikomia marketplace can be connected to this converter.

Coco examples

🚀 Use with Ikomia API

1. Install Ikomia API

We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.

pip install ikomia

2. Create your workflow

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="dataset_coco", auto_connect=False)

algo.set_parameters({"json_file": "path/to/annotations_file.json",
                     "image_folder": "path/to/image_folder",
                     "task": "detection"})

# Add your training algorithm. Choose it accordingly to the "task" parameter
train = wf.add_task(name="train_yolo_v8", auto_connect=True)

# Start training  
wf.run()

☀️ Use with Ikomia Studio

Ikomia Studio offers a friendly UI with the same features as the API.

  • If you haven't started using Ikomia Studio yet, download and install it from this page.

  • For additional guidance on getting started with Ikomia Studio, check out this blog post.

📝 Set algorithm parameters

  • json_file (str): Annotation file (.json) in COCO format. See this page for more information about the COCO format.
  • image_folder (str): Folder containing images annotated in the annotation file.
  • task (str) - Default "detection": Task of the dataset. It should be one of : "detection", "instance_segmentation", "semantic_segmentation" or "keypoints".
  • output_folder (str) - Default "": Only needed when task=="semantic_segmentation". COCO format does not support semantic segmentation so we need to compute semantic segmentation masks from instance segmentation masks, and store the computed masks in a folder determined by this parameter.

Parameters should be in strings format when added to the dictionary.

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="dataset_coco", auto_connect=True)

algo.set_parameters({"json_file": "path/to/annotations_file.json",
                     "image_folder": "path/to/image_folder",
                     "task": "detection",
                     "output_folder": ""})