This document explains how to train your own YOLO model and anonymize images in ROS2 bag files with the trained YOLO model or the unified model.
Create an initial dataset with the unified model. You can provide multiple rosbags to create a dataset. You should set your configuration in config/yolo_create_dataset.yaml
file. After running the following command, the tool will create a dataset in YOLO format.
python3 main.py config/yolo_create_dataset.yaml --yolo_create_dataset
The dataset which is created in the first step has some missing labels. You should label the missing labels manually. You can use the following example tools to label the missing labels:
- label-studio
- Roboflow (You can use the free version)
After labeling the missing labels, you should split the dataset into train and validation sets. If the labeling tool you used does not provide a split option, you can use the following command to split the dataset.
Give the path to the dataset folder which is created in the first step.
autoware-rosbag2-anonymizer-split-dataset /path/to/dataset
Train the YOLO model with the dataset.
You should set your configuration in config/yolo_train.yaml
file.
python3 main.py config/yolo_train.yaml --yolo_train
Anonymize images in ROS2 bag files with the trained YOLO model.
You should set your configuration in config/yolo_anonymize.yaml
file.
If you want to anonymize your ROS2 bag file with only YOLO model,
you should use following command.
But we recommend to use the unified model for better results.
You can follow the Option 1
for the unified model with the YOLO model trained by you.
python3 main.py config/yolo_anonymize.yaml --yolo_anonymize