Using Pysolotools to Convert From SOLO to COCO
The SOLO format was created by us to be able to efficiently store all of the data, annotations, and metrics generated by the Perception toolkit. However, in order to use existing computer vision models, your data will need to be converted into a format that those models can ingest. One of the most common interchagne formats is the COCO format. This guide will walk you through the entire process of converting a dataset from the SOLO format into the COCO format. We will use Unity's Computer Vision Team's pysolotools to accomplish this task. Pysolotools is a Python package that provides a variety of tools for processing, analyzing, and converting SOLO datasets generated using the Perception package.
Set up your python environment
The first step that we will need to do is to setup our python environment. To avoid a python configuration nightmare, we highly recommend using a virtual python environment for development. For this tutorial we will use anaconda, but this is just a recommendation and not mandatory. For more information about Anaconda environments, and why you should use one, please see here.
- 🟢 Action: Download and install Anaconda or Miniconda on your local machine
- 🟢 Action: Create or reuse a virtual environment.
For this example we are naming our environment
pysolotools_env
, but this name is up to you. If you have already created an environment from the previous step in the tutorial, you can reuse that environment (skip this step).
conda create --name pysolotools_env python=3.8
- 🟢 Action: Activate the new conda env. Activating puts you in your new virtual environment
conda activate pysolotools_env
Install pysolotools
- 🟢 Action: Install pysolotools using pip with the following command
pip install pysolotools
ℹ️ The above will not work until we go public. Until then you need to install pysolotools with
pip install pysolotools --index-url=https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
this info should be remvoed when we go public
Converting from SOLO to COCO
Pysolotools comes with a command line application to convert from SOLO dataset to COCO.
- 🟢 Action: Inside your terminal, navigate to your pysolotools directory
- 🟢 Action: Convert your data with the following command:
solo2coco <SOLO_PATH> <COCO_PATH>
You can also optionally supply a name for the coco dataset with -n or --name arguments. The name coco is used by default.
And that is all that there is to it. Now, if you navigate to the directory specified that you supplied to the command with the COCO_PATH variable, you will see your converted COCO dataset. At this time, pysolotools comes with converters to COCO and YOLO.