From da997ccadb01618385d7731b354533803f818466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Fri, 24 May 2024 17:35:38 +0300 Subject: [PATCH 01/12] feat: add autoware_rosbag2_anonymizer usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/.pages | 1 + docs/datasets/data-anonymization/index.md | 229 ++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 docs/datasets/data-anonymization/index.md diff --git a/docs/datasets/.pages b/docs/datasets/.pages index 35fd5a113be..31aa9ff5c69 100644 --- a/docs/datasets/.pages +++ b/docs/datasets/.pages @@ -1,2 +1,3 @@ nav: - index.md + - Data Anonymization: data-anonymization \ No newline at end of file diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md new file mode 100644 index 00000000000..9967791b99b --- /dev/null +++ b/docs/datasets/data-anonymization/index.md @@ -0,0 +1,229 @@ +# Rosbag2 Anonymizer + +## Overview + +Autoware provides a tool to anonymize ROS2 bag files. +This tool is useful when you want to share your data with Autoware community but want to keep the privacy of the data. + +With this tool you can blur any object (faces, license plates, etc.) in your bag files, and you can get a new bag file +with the blurred images. + +## Installation + +### Clone the repository + +```bash +git clone https://github.com/autowarefoundation/autoware_rosbag2_anonymizer.git +``` + +### Download the pretrained models + +```bash +wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth + +wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_SwinB.cfg.py +wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swinb_cogcoor.pth + +wget https://github.com/autowarefoundation/autoware_rosbag2_anonymizer/releases/download/v0.0.0/yolov8x_anonymizer.pt +``` + +### Install ros2 mcap dependencies if you will use mcap files + +!!! warning + + Be sure you have installed the ROS2 on your system. + +```bash +sudo apt install ros-humble-rosbag2-storage-mcap +``` + +### Install `autoware_rosbag2_anonymizer` tool + +```bash +python3 -m pip install . +``` + +## Configuration + +Define prompts in the validation.jsonfile. The tool will use these prompts to detect objects. You can add your prompts +as dictionaries under the prompts key. Each dictionary should have two keys: + +- `prompt`: The prompt that will be used to detect the object. This prompt will be blurred in the anonymization process. +- `should_inside`: This is a list of prompts that object should be inside. If the object is not inside the prompts, the + tool will not blur the object. + +```json +{ + "prompts": [ + { + "prompt": "license plate", + "should_inside": [ + "car", + "bus", + "..." + ] + }, + { + "prompt": "human face", + "should_inside": [ + "person", + "human body", + "..." + ] + } + ] +} +``` + +You should set your configuration in the configuration files under config folder according to the usage. Following +instructions will guide you to set each configuration file. + +- `config/anonymize_with_unified_model.yaml` + +```yaml +rosbag: + input_bag_path: "path/to/input.bag" # Path to the input ROS2 bag file with 'mcap' or 'sqlite3' extension + output_bag_path: "path/to/output/folder" # Path to the output ROS2 bag folder + output_save_compressed_image: True # Save images as compressed images (True or False) + output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) + +grounding_dino: + box_threshold: 0.1 # Threshold for the bounding box (float) + text_threshold: 0.1 # Threshold for the text (float) + nms_threshold: 0.1 # Threshold for the non-maximum suppression (float) + +open_clip: + score_threshold: 0.7 # Validity threshold for the OpenCLIP model (float + +yolo: + confidence: 0.15 # Confidence threshold for the YOLOv8 model (float) + +bbox_validation: + iou_threshold: 0.9 # Threshold for the intersection over union (float), if the intersection over union is greater than this threshold, the object will be selected as inside the validation prompt + +blur: + kernel_size: 31 # Kernel size for the Gaussian blur (int) + sigma_x: 11 # Sigma x for the Gaussian blur (int) +``` + +- `config/yolo_create_dataset.yaml` + +```yaml +rosbag: + input_bags_folder: "path/to/input/folder" # Path to the input ROS2 bag files folder + +dataset: + output_dataset_folder: "path/to/output/folder" # Path to the output dataset folder + output_dataset_subsample_coefficient: 25 # Subsample coefficient for the dataset (int) + +grounding_dino: + box_threshold: 0.1 # Threshold for the bounding box (float) + text_threshold: 0.1 # Threshold for the text (float) + nms_threshold: 0.1 # Threshold for the non-maximum suppression (float) + +open_clip: + score_threshold: 0.7 # Validity threshold for the OpenCLIP model (float + +bbox_validation: + iou_threshold: 0.9 # Threshold for the intersection over union (float), if the intersection over union is greater than this threshold, the object will be selected as inside the validation prompt +``` + +- `config/yolo_train.yaml` + +```yaml +dataset: + input_dataset_yaml: "path/to/input/data.yaml" # Path to the config file of the dataset, which is created in the previous step + +yolo: + epochs: 100 # Number of epochs for the YOLOv8 model (int) + model: 'yolov8x.pt' # Select the base model for YOLOv8 ('yolov8x.pt' 'yolov8l.pt', 'yolov8m.pt', 'yolov8n.pt') +``` + +- `config/yolo_anonymize.yaml` + +```yaml +rosbag: + input_bag_path: "path/to/input.bag" # Path to the input ROS2 bag file with 'mcap' or 'sqlite3' extension + output_bag_path: "path/to/output/folder" # Path to the output ROS2 bag folder + output_save_compressed_image: True # Save images as compressed images (True or False) + output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) + +yolo: + model: "path/to/yolo/model" # Path to the trained YOLOv8 model file (`.pt` extension) (you can download the pre-trained model from releases) + config_path: "path/to/input/data.yaml" # Path to the config file of the dataset, which is created in the previous step + confidence: 0.15 # Confidence threshold for the YOLOv8 model (float) + +blur: + kernel_size: 31 # Kernel size for the Gaussian blur (int) + sigma_x: 11 # Sigma x for the Gaussian blur (int) +``` + +## Usage + +The tool provides two options to anonymize images in ROS2 bag files. + +### Option 1: Anonymize with Unified Model + +You should provide a single rosbag and tool anonymize images in rosbag with a unified model. The model is a combination +of GroundingDINO, OpenCLIP, YOLOv8 and SegmentAnything. If you don't want to use pre-trained YOLOv8 model, you can +follow the instructions in the second option to train your own YOLOv8 model. + +You should set your configuration in config/anonymize_with_unified_model.yaml file. + +```bash +python3 main.py config/anonymize_with_unified_model.yaml --anonymize_with_unified_model +``` + +### Option 2: Anonymize Using the YOLOv8 Model Trained on a Dataset Created with the Unified Model + +#### Step 1: Create a Dataset + +Create an initial dataset with the unified model. You can provide multiple ROS2 bag files to create a dataset. After +running the following command, the tool will create a dataset in YOLO format. + +You should set your configuration in config/yolo_create_dataset.yaml file. + +```bash +python3 main.py config/yolo_create_dataset.yaml --yolo_create_dataset +``` + +#### Step 2: Manually Label the Missing Labels + +The dataset which is created in the first step has some missing labels. You should label the missing labels manually. + +#### Step 3: Split the Dataset + +Split the dataset into training and validation sets. Give the path to the dataset folder which is created in the first +step. + +```bash +autoware-rosbag2-anonymizer-split-dataset /path/to/dataset/folder +``` + +#### Step 4: Train the YOLOv8 Model + +Train the YOLOv8 model with the dataset which is created in the first step. + +You should set your configuration in config/yolo_train.yaml file. + +```bash +python3 main.py config/yolo_train.yaml --yolo_train +``` + +#### Step 5: Anonymize Images in ROS2 Bag Files + +Anonymize images in ROS2 bag files with the trained YOLOv8 model. If you want to anonymize your ROS2 bag file with only +YOLOv8 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 YOLOv8 model trained by you. + +You should set your configuration in config/yolo_anonymize.yaml file. + +```bash +python3 main.py config/yolo_anonymize.yaml --yolo_anonymize +``` + +## Share Your Anonymized Data + +After anonymizing your data, you can share your anonymized data with the Autoware community. If you want to share your +data with the Autoware community, you should create an issue and pull request to +the [Autoware Documentation repository](https://github.com/autowarefoundation/autoware-documentation). \ No newline at end of file From 7cc5a34db9db03de75676741acdca28c0cd07aae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 14:48:12 +0000 Subject: [PATCH 02/12] style(pre-commit): autofix --- docs/datasets/.pages | 2 +- docs/datasets/data-anonymization/index.md | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/datasets/.pages b/docs/datasets/.pages index 31aa9ff5c69..8a911fbc06c 100644 --- a/docs/datasets/.pages +++ b/docs/datasets/.pages @@ -1,3 +1,3 @@ nav: - index.md - - Data Anonymization: data-anonymization \ No newline at end of file + - Data Anonymization: data-anonymization diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 9967791b99b..4c571261123 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -57,19 +57,11 @@ as dictionaries under the prompts key. Each dictionary should have two keys: "prompts": [ { "prompt": "license plate", - "should_inside": [ - "car", - "bus", - "..." - ] + "should_inside": ["car", "bus", "..."] }, { "prompt": "human face", - "should_inside": [ - "person", - "human body", - "..." - ] + "should_inside": ["person", "human body", "..."] } ] } @@ -136,7 +128,7 @@ dataset: yolo: epochs: 100 # Number of epochs for the YOLOv8 model (int) - model: 'yolov8x.pt' # Select the base model for YOLOv8 ('yolov8x.pt' 'yolov8l.pt', 'yolov8m.pt', 'yolov8n.pt') + model: "yolov8x.pt" # Select the base model for YOLOv8 ('yolov8x.pt' 'yolov8l.pt', 'yolov8m.pt', 'yolov8n.pt') ``` - `config/yolo_anonymize.yaml` @@ -226,4 +218,4 @@ python3 main.py config/yolo_anonymize.yaml --yolo_anonymize After anonymizing your data, you can share your anonymized data with the Autoware community. If you want to share your data with the Autoware community, you should create an issue and pull request to -the [Autoware Documentation repository](https://github.com/autowarefoundation/autoware-documentation). \ No newline at end of file +the [Autoware Documentation repository](https://github.com/autowarefoundation/autoware-documentation). From 712896f4f0130f50501ec2a37195a101e0fc4a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Wed, 29 May 2024 10:29:33 +0300 Subject: [PATCH 03/12] fix: spell-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 9967791b99b..377136f3665 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -2,7 +2,7 @@ ## Overview -Autoware provides a tool to anonymize ROS2 bag files. +Autoware provides a tool to anonymize ROS 2 bag files. This tool is useful when you want to share your data with Autoware community but want to keep the privacy of the data. With this tool you can blur any object (faces, license plates, etc.) in your bag files, and you can get a new bag file @@ -31,7 +31,7 @@ wget https://github.com/autowarefoundation/autoware_rosbag2_anonymizer/releases/ !!! warning - Be sure you have installed the ROS2 on your system. + Be sure you have installed the ROS 2 on your system. ```bash sudo apt install ros-humble-rosbag2-storage-mcap @@ -160,7 +160,7 @@ blur: ## Usage -The tool provides two options to anonymize images in ROS2 bag files. +The tool provides two options to anonymize images in ROS 2 bag files. ### Option 1: Anonymize with Unified Model @@ -178,7 +178,7 @@ python3 main.py config/anonymize_with_unified_model.yaml --anonymize_with_unifie #### Step 1: Create a Dataset -Create an initial dataset with the unified model. You can provide multiple ROS2 bag files to create a dataset. After +Create an initial dataset with the unified model. You can provide multiple ROS 2 bag files to create a dataset. After running the following command, the tool will create a dataset in YOLO format. You should set your configuration in config/yolo_create_dataset.yaml file. @@ -210,7 +210,7 @@ You should set your configuration in config/yolo_train.yaml file. python3 main.py config/yolo_train.yaml --yolo_train ``` -#### Step 5: Anonymize Images in ROS2 Bag Files +#### Step 5: Anonymize Images in ROS 2 Bag Files Anonymize images in ROS2 bag files with the trained YOLOv8 model. If you want to anonymize your ROS2 bag file with only YOLOv8 model, you should use following command. But we recommend to use the unified model for better results. You can From f1524ccbe4ec2c6503a8b9a5b1125fa77c10ec94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Wed, 29 May 2024 10:34:12 +0300 Subject: [PATCH 04/12] fix: spell-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index d83c81540a6..2b508103115 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -27,7 +27,7 @@ wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_ wget https://github.com/autowarefoundation/autoware_rosbag2_anonymizer/releases/download/v0.0.0/yolov8x_anonymizer.pt ``` -### Install ros2 mcap dependencies if you will use mcap files +### Install ROS 2 mcap dependencies if you will use mcap files !!! warning @@ -74,8 +74,8 @@ instructions will guide you to set each configuration file. ```yaml rosbag: - input_bag_path: "path/to/input.bag" # Path to the input ROS2 bag file with 'mcap' or 'sqlite3' extension - output_bag_path: "path/to/output/folder" # Path to the output ROS2 bag folder + input_bag_path: "path/to/input.bag" # Path to the input ROS 2 bag file with 'mcap' or 'sqlite3' extension + output_bag_path: "path/to/output/folder" # Path to the output ROS 2 bag folder output_save_compressed_image: True # Save images as compressed images (True or False) output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) @@ -102,7 +102,7 @@ blur: ```yaml rosbag: - input_bags_folder: "path/to/input/folder" # Path to the input ROS2 bag files folder + input_bags_folder: "path/to/input/folder" # Path to the input ROS 2 bag files folder dataset: output_dataset_folder: "path/to/output/folder" # Path to the output dataset folder @@ -135,8 +135,8 @@ yolo: ```yaml rosbag: - input_bag_path: "path/to/input.bag" # Path to the input ROS2 bag file with 'mcap' or 'sqlite3' extension - output_bag_path: "path/to/output/folder" # Path to the output ROS2 bag folder + input_bag_path: "path/to/input.bag" # Path to the input ROS 2 bag file with 'mcap' or 'sqlite3' extension + output_bag_path: "path/to/output/folder" # Path to the output ROS 2 bag folder output_save_compressed_image: True # Save images as compressed images (True or False) output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) @@ -204,7 +204,7 @@ python3 main.py config/yolo_train.yaml --yolo_train #### Step 5: Anonymize Images in ROS 2 Bag Files -Anonymize images in ROS2 bag files with the trained YOLOv8 model. If you want to anonymize your ROS2 bag file with only +Anonymize images in ROS 2 bag files with the trained YOLOv8 model. If you want to anonymize your ROS 2 bag file with only YOLOv8 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 YOLOv8 model trained by you. From 57b7ace2854a05c13b62a222e2dcfb78c5ba1b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Sun, 23 Jun 2024 20:14:41 +0300 Subject: [PATCH 05/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 2b508103115..749e6530def 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -2,7 +2,7 @@ ## Overview -Autoware provides a tool to anonymize ROS 2 bag files. +Autoware provides a tool ([autoware_rosbag2_anonymizer](https://github.com/autowarefoundation/autoware_rosbag2_anonymizer)) to anonymize ROS 2 bag files. This tool is useful when you want to share your data with Autoware community but want to keep the privacy of the data. With this tool you can blur any object (faces, license plates, etc.) in your bag files, and you can get a new bag file @@ -14,6 +14,7 @@ with the blurred images. ```bash git clone https://github.com/autowarefoundation/autoware_rosbag2_anonymizer.git +cd autoware_rosbag2_anonymizer ``` ### Download the pretrained models @@ -25,6 +26,7 @@ wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_ wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swinb_cogcoor.pth wget https://github.com/autowarefoundation/autoware_rosbag2_anonymizer/releases/download/v0.0.0/yolov8x_anonymizer.pt +wget https://github.com/autowarefoundation/autoware_rosbag2_anonymizer/releases/download/v0.0.0/yolo_config.yaml ``` ### Install ROS 2 mcap dependencies if you will use mcap files @@ -39,6 +41,14 @@ sudo apt install ros-humble-rosbag2-storage-mcap ### Install `autoware_rosbag2_anonymizer` tool +Before installing the tool, you should update the pip package manager. + +```bash +python3 -m pip install pip -U +``` + +Then, you can install the tool with the following command. + ```bash python3 -m pip install . ``` @@ -74,8 +84,8 @@ instructions will guide you to set each configuration file. ```yaml rosbag: - input_bag_path: "path/to/input.bag" # Path to the input ROS 2 bag file with 'mcap' or 'sqlite3' extension - output_bag_path: "path/to/output/folder" # Path to the output ROS 2 bag folder + input_bags_folder: "/path/to/input_bag_folder" # Path to the input folder which contains ROS 2 bag files + output_bags_folder: "/path/to/output_folder" # Path to the output ROS 2 bag folder output_save_compressed_image: True # Save images as compressed images (True or False) output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) @@ -102,10 +112,10 @@ blur: ```yaml rosbag: - input_bags_folder: "path/to/input/folder" # Path to the input ROS 2 bag files folder + input_bags_folder: "/path/to/input_bag_folder" # Path to the input ROS 2 bag files folder dataset: - output_dataset_folder: "path/to/output/folder" # Path to the output dataset folder + output_dataset_folder: "/path/to/output/dataset" # Path to the output dataset folder output_dataset_subsample_coefficient: 25 # Subsample coefficient for the dataset (int) grounding_dino: @@ -124,7 +134,7 @@ bbox_validation: ```yaml dataset: - input_dataset_yaml: "path/to/input/data.yaml" # Path to the config file of the dataset, which is created in the previous step + input_dataset_yaml: "path/to/data.yaml" # Path to the config file of the dataset, which is created in the previous step yolo: epochs: 100 # Number of epochs for the YOLOv8 model (int) @@ -135,8 +145,8 @@ yolo: ```yaml rosbag: - input_bag_path: "path/to/input.bag" # Path to the input ROS 2 bag file with 'mcap' or 'sqlite3' extension - output_bag_path: "path/to/output/folder" # Path to the output ROS 2 bag folder + input_bag_path: "/path/to/input_bag/bag.mcap" # Path to the input ROS 2 bag file with 'mcap' or 'sqlite3' extension + output_bag_path: "/path/to/output_bag_file" # Path to the output ROS 2 bag folder output_save_compressed_image: True # Save images as compressed images (True or False) output_storage_id: "sqlite3" # Storage id for the output bag file (`sqlite3` or `mcap`) From 4c66e34173113992b729d742f2f2e72844f0e7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Sat, 17 Aug 2024 17:36:08 +0300 Subject: [PATCH 06/12] chore: add citation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 749e6530def..dc798c4982f 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -229,3 +229,49 @@ python3 main.py config/yolo_anonymize.yaml --yolo_anonymize After anonymizing your data, you can share your anonymized data with the Autoware community. If you want to share your data with the Autoware community, you should create an issue and pull request to the [Autoware Documentation repository](https://github.com/autowarefoundation/autoware-documentation). + +## Citation + +```bibtex +@article{liu2023grounding, + title={Grounding dino: Marrying dino with grounded pre-training for open-set object detection}, + author={Liu, Shilong and Zeng, Zhaoyang and Ren, Tianhe and Li, Feng and Zhang, Hao and Yang, Jie and Li, Chunyuan and Yang, Jianwei and Su, Hang and Zhu, Jun and others}, + journal={arXiv preprint arXiv:2303.05499}, + year={2023} +} +``` + +```bibtex +@article{kirillov2023segany, + title={Segment Anything}, + author={Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Doll{\'a}r, Piotr and Girshick, Ross}, + journal={arXiv:2304.02643}, + year={2023} +} +``` + +```bibtex +@software{ilharco_gabriel_2021_5143773, + author = {Ilharco, Gabriel and + Wortsman, Mitchell and + Wightman, Ross and + Gordon, Cade and + Carlini, Nicholas and + Taori, Rohan and + Dave, Achal and + Shankar, Vaishaal and + Namkoong, Hongseok and + Miller, John and + Hajishirzi, Hannaneh and + Farhadi, Ali and + Schmidt, Ludwig}, + title = {OpenCLIP}, + month = jul, + year = 2021, + note = {If you use this software, please cite it as below.}, + publisher = {Zenodo}, + version = {0.1}, + doi = {10.5281/zenodo.5143773}, + url = {https://doi.org/10.5281/zenodo.5143773} +} +``` \ No newline at end of file From 4c22060abf44fbdd1bc2c8c616dc2c7e3ad37c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Sat, 17 Aug 2024 17:37:34 +0300 Subject: [PATCH 07/12] fix: typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index dc798c4982f..dd8ff96b972 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -55,7 +55,7 @@ python3 -m pip install . ## Configuration -Define prompts in the validation.jsonfile. The tool will use these prompts to detect objects. You can add your prompts +Define prompts in the `validation.json` file. The tool will use these prompts to detect objects. You can add your prompts as dictionaries under the prompts key. Each dictionary should have two keys: - `prompt`: The prompt that will be used to detect the object. This prompt will be blurred in the anonymization process. From a8b4acffefb4744e57243296da3c06d814858473 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:38:11 +0000 Subject: [PATCH 08/12] style(pre-commit): autofix --- docs/datasets/data-anonymization/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index dd8ff96b972..618fe7c1c48 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -274,4 +274,4 @@ the [Autoware Documentation repository](https://github.com/autowarefoundation/au doi = {10.5281/zenodo.5143773}, url = {https://doi.org/10.5281/zenodo.5143773} } -``` \ No newline at end of file +``` From 358c39c100ff774c7b58b7918d7cacb0642bdd3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Tue, 27 Aug 2024 14:27:48 +0300 Subject: [PATCH 09/12] chore: add troubleshooting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 618fe7c1c48..730b0fe7b97 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -224,6 +224,21 @@ You should set your configuration in config/yolo_anonymize.yaml file. python3 main.py config/yolo_anonymize.yaml --yolo_anonymize ``` +## Troubleshooting + +- **Error 1**: `torch.OutOfMemoryError: CUDA out of memory` + +```bash +torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 1024.00 MiB. GPU 0 has a total capacity of 10.87 GiB of which 1010.88 MiB is free. Including non-PyTorch memory, this process has 8.66 GiB memory in use. Of the allocated memory 8.21 GiB is allocated by PyTorch, and 266.44 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables) +``` + +This error occurs when the GPU memory is not enough to run the model. You can add the following environment variable to +avoid this error. + +```bash +export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True +``` + ## Share Your Anonymized Data After anonymizing your data, you can share your anonymized data with the Autoware community. If you want to share your From d9a4c3e87643523045724731a20e6cf00e1ee072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Tue, 3 Sep 2024 13:16:52 +0300 Subject: [PATCH 10/12] chore: add warning for custom messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 730b0fe7b97..5e0f1cdf42d 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -164,6 +164,16 @@ blur: The tool provides two options to anonymize images in ROS 2 bag files. +!!! warning + + If your ROS 2 bag file includes custom message types from Autoware or any other packages, you should source the + their workspaces before running the tool. + + You can source Autoware workspace with the following command. + ```bash + source /path/to/your/workspace/install/setup.bash + ``` + ### Option 1: Anonymize with Unified Model You should provide a single rosbag and tool anonymize images in rosbag with a unified model. The model is a combination From bf7f68ffdb6694746eed301f6b96a64af041aace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Zeren?= Date: Tue, 3 Sep 2024 13:22:30 +0300 Subject: [PATCH 11/12] chore: add example label tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Barış Zeren --- docs/datasets/data-anonymization/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 5e0f1cdf42d..4043c82a662 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -202,6 +202,10 @@ python3 main.py config/yolo_create_dataset.yaml --yolo_create_dataset #### Step 2: Manually Label the Missing Labels 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](https://github.com/HumanSignal/label-studio) +- [Roboflow](https://roboflow.com/) (You can use the free version) #### Step 3: Split the Dataset From 460e160df404ee637d0235ef252c0b6719650c5a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:23:44 +0000 Subject: [PATCH 12/12] style(pre-commit): autofix --- docs/datasets/data-anonymization/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/datasets/data-anonymization/index.md b/docs/datasets/data-anonymization/index.md index 4043c82a662..f9e45ab56f6 100644 --- a/docs/datasets/data-anonymization/index.md +++ b/docs/datasets/data-anonymization/index.md @@ -166,7 +166,7 @@ The tool provides two options to anonymize images in ROS 2 bag files. !!! warning - If your ROS 2 bag file includes custom message types from Autoware or any other packages, you should source the + If your ROS 2 bag file includes custom message types from Autoware or any other packages, you should source the their workspaces before running the tool. You can source Autoware workspace with the following command.