Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
/ OSCAR Public archive

Latest commit

 

History

History
130 lines (85 loc) · 3.34 KB

README.md

File metadata and controls

130 lines (85 loc) · 3.34 KB

OSCAR Datagen Toolkit

This repository contains a set of tools for generating synthetic datasets using the CARLA Simulator. CARLA is an open-source simulator for autonomous driving research that provides realistic urban environments, dynamic traffic, and realistic sensors.

Requirements

If you want to install the tools outside of the Docker container, build and install the CARLA Python package before install the tools:

cd docker

# build the CARLA client
# NOTE: Specify the Python3 version you want to use
./build.sh --python-version=3.9

# install CARLA
pip install dist/carla-0.9.13-cp39-cp39-linux_x86_64.whl

Note: It is recommended to create a Python virtual environment.

# [OPTIONAL] create conda environment
conda create -n myenv python=3.9
conda activate myenv

# [OPTIONAL] create virtualenv environment
python3.9 -m venv .venv
source .venv/bin/activate

Getting started

Quickstart

# collect data
./scripts/collect.sh simulation=<SIMULATION_NAME>

# annotate
./scripts/annotate.sh <FORMAT>

For more information about the command options see Tools section.

Install from source code

  1. Run the following command:
pip install .

Note: In this case, make sure that you have a running CARLA server to connect with.

[Optional] Install the pre-commit hook to verify code style:

pip install pre-commit==2.20.0

# To run the hook on every commit
pre-commit install

# To run it manually
pre-commit run -a

Tools

The following tools are included in this repository:

oscar_data_saver

This script sets up a CARLA simulation under certain parameters specified in one of the YAML's configuration files located at configs/simulation, and then proceed with collection of the data from the sensors included in that simulation. To use this script run:

# Option #1
./scripts/collect.sh simulation=<SIMULATION_NAME>

# Option #2
./scripts/collect.sh --config=path/to/config

where SIMULATION_NAME is the name of one of the simulation stored in configs/simulation.

To run this tool outside the Docker container use the following command"

# Option #1
oscar_data_saver --config-dir=</path/to/config/directory> --config-name=<CONFIG_NAME>

# Option #2
oscar_data_saver simulation=<SIMULATION_NAME>

Find here an example configuration file.

The PROJECT_ROOT environment variable is used to define the base path where the data will be stored.

oscar_data_annotator

This script takes the data previously generated by the oscar_data_saver tool and creates COCO- or MOTS-compatible datasets. The following is an example of how to use this tool:

./scripts/annotate.sh <FORMAT>

where:

  • FORMAT: type of annotation that is going to be generated (kwcoco, mots_txt or mots_png).

Note: The tool will look for the directories containing data and annotate them.

To run this tool outside the Docker container use the following command:

oscar_data_annotator <FORMAT> --dataset_parent_dir="data/"

Notebook

In the collection_and_annotation.ipynb notebook you can find and example of how to collect data, annotate that data, and insert perturbations into a sample image.

To run the notebooks use:

./scripts/notebook.sh