This Python API gets a variety of data from CARLA Simulator and also helps automatically generate the Ground Truth according to the Darknet YOLO Framework. The Ground Truth on the objects provided are the vehicle and the pedestrian.
cd [carla directory]/PythonAPI/examples
git clone https://github.com/AveesLab/CarFree.git
This API helps you information about the RGB Image, the Semantic Segmentation Image and the Bounding Box of Objects from the CARLA Server. In addition, it allows users to capture these informations at regular intervals and keyboard inputs.
- CARLA Server on
./CarlaUE4.sh
- Spawn Object and Change Various Weathers (CARLA Python example). Link: [https://github.com/carla-simulator/carla/tree/master/PythonAPI/examples]
Spawn NPC (Vehicles and Walkers).
./spawn.py -n N -w W
./weather.py
Execute Generating Code
Obtain information about the RGB Image, the Semantic segmentation Image and Bounding Boxes for Ground Truth Generation from CARLA.
When a period (loop N) is specified, data capture is executed at that interval. This API helps users control the start and end of automatic capture through the keyboard input. It also provides a feature that allows users to capture the scene they want immediately at the moment.
./extract.py -l N
These datas (RGB, Segmentation and Bounding Box) are stored in different folders at the same time.
This API helps to post-process the data obtained above and to create a Ground Truth for Darknet YOLO Framework.
./generate.py
Data for learning is stored in a folder 'custom_data', and results of the bounding box generated in folder 'draw_bounding_box' can be seen. It will create .txt file for each .png rgb image file with the same name in the same directory. Ground truth formet of Darknet is shown below.
[object's class] [x_center] [y_center] [image_width] [image_height]
-
Object number Vehicle : 0, Person (Pedestrian) : 1
-
Other data Datas without object's class number are expressed between 0 and 1.
-
In addition, the image path to train is saved in 'my_data' folder in the form of a .txt file.
custom_data/rgb1.png
custom_data/rgb2.png
custom_data/rgb3.png