Home

Awesome

BMW-Anonymization-Api

Data privacy and individuals’ anonymity are and always have been a major concern for data-driven companies.

Therefore, we designed and implemented an anonymization API that localizes and obfuscates (i.e. hides) sensitive information in images/videos in order to preserve the individuals' anonymity. The main features of our anonymization tool are the following:

<p align="center"> <img src="references/output_7.gif" alt="animated" /> </p>

General Architecture & Deployment Mode:

Our anonymization API receives an image along with a JSON object through which the user specifies mainly:

You can deploy the anonymization API either:

Prerequisites:

Check for prerequisites

To check if docker-ce is installed:

docker --version

To check if docker-compose is installed:

docker-compose --version

Install prerequisites

Ubuntu

To install Docker and Docker Compose on Ubuntu, please follow the link.

Windows 10

To install Docker on Windows, please follow the link.

P.S: For Windows users, open the Docker Desktop menu by clicking the Docker Icon in the Notifications area. Select Settings, and then Advanced tab to adjust the resources available to Docker Engine.

Build The Docker Image

As mentioned before, this container can be deployed using either docker or docker-compose.

In order to build the project run the following command from the project's root directory:

 docker build -t anonymization_api -f docker/dockerfile .

Build behind a proxy

In order to build the image behind a proxy use the following command in the project's root directory:

docker build --build-arg http_proxy='your_proxy' --build-arg https_proxy='your_proxy' -t anonymization_api -f ./docker/dockerfile .

Run the docker container

To run the API, go to the API's directory and run the following:

Using Linux based docker:

sudo docker run -itv $(pwd)/src/main:/main -v $(pwd)/jsonFiles:/jsonFiles -p <port_of_your_choice>:4343 anonymization_api
Behind a proxy:
sudo docker run -itv $(pwd)/src/main:/main -v $(pwd)/jsonFiles:/jsonFiles  --env HTTP_PROXY="" --env HTTPS_PROXY="" --env http_proxy="" --env https_proxy="" -p 5555:4343 anonymization_api

Using Windows based docker:

docker run -itv ${PWD}/src/main:/main -v ${PWD}/jsonFiles:/jsonFiles -p <port_of_your_choice>:4343 anonymization_api

The API file will be run automatically, and the service will listen to http requests on the chosen port.

API Endpoints

To see all available endpoints, open your favorite browser and navigate to:

http://<machine_IP>:<docker_host_port>/docs

Endpoints summary

Configuration

/set_url (POST)

Set the URL of the inference API that you wish to connect to the Anonymization API. If the specified URL is unreachable due to connection problems, it will not be added to the JSON url_configuration file. The URL should be specified in the following format "http://ip:port/".

/list_urls (GET)

Returns the URLs of the inference APIs that were already configured via the /set_url POST request.

/remove_url (POST)

Removes the specified URL from the JSON url_configuration file

/remove_all_urls (POST)

Removes all available urls from the JSON url_configuration file

/available_methods/ (GET)

After setting the inference URLs via the /set_url request, the user can view the Anonymization API's configuration by issuing the /available_methods request. Mainly the user can view (i) the supported sensitive information (label_names) , (ii) the supported localization techniques, (iii) the inference URLs and (iv) the DL model name that are configured in the deployed anonymization API as seen below.

<img alt="" src="./references/available_methods.gif?raw=" width="800" >

Anonymization

/anonymize/ (POST)

Anonymizes the input image based on the user's JSON configuration file

<img alt="" src="./references/anonymize.gif?raw=" width="800" >
/anonymize_video/ (POST)

Anonymizes a video based on the user's sensitive info and save the anonymized video in src/main/anonymized_videos under <original_video_name>_TIMESTAMP.mp4

<img src="./references/anonymize_video.gif?raw=" width="800" >

Video Anonymization Time

The video might take a while, actually you can estimate the time that it may take by using the following formula: Video_Anonymization_Time = Video_Length x Number_Of_Frames_Per_Second x Anonymization_Time_Of_Each_Frame

User configuration file sample

In order to anonymize an image, the user should specify the different details in the user's JSON configuration file

Please check a sample in the below image:

Note that the URL field is an optional field that you can add in case you wanted to use a specific URL of a running API. You can just add the URL as an optional field in this file as shown in the first sensitive info. In case this field is not specified, the URL defined in the url_configuration.json file will be used by default if it matches all the requirements.

To add a new technique to the API:

Please refer to the following link add new technique documentation for more information on how to add a new anonymization technique to the APIs with common and custom labels.

Benchmark

Object Detection

GPUNetworkWidthHeightInference Time (s)Anonymization Time (s)Total Time (s)
Titan RTXyolov46407680.20.070.27
Titan RTXyolov410247680.40.140.54
Titan RTXyolov4204810241.20.61.8
Titan RTXyolov4384021604.80.65.4

Object Detection with OpenVINO model and Intel Core i7-1185G7

The model was trained with the TensorFlow Object Detection API (TF version 1.14) and then converted to OpenVINO IR using Intel® OpenVINO™ toolkit v2021.4 </br> <span style="font-size:2em;">Results may vary. For workloads and configurations visit: www.intel.com/PerformanceIndex and Legal Information. </span>

CPUNetworkPrecisionWidthHeightInference Time (s)Anonymization Time (s)Total Time (s) <br/> for Avg, Max, Min
Intel Core <br/> i7-1185G7Faster R-CNN <br/> Input Shape: [3,600,600]FP3210247680.510.090.60, 0.67, 0.54
Intel Core <br/> i7-1185G7Faster R-CNN <br/> Input Shape: [3,600,600]FP32204815360.560.240.80, 0.97, 0.70
Intel Core <br/> i7-1185G7Faster R-CNN <br/> Input Shape: [3,600,600]INT810247680.160.090.25, 0.27, 0.22
Intel Core <br/> i7-1185G7Faster R-CNN <br/> Input Shape: [3,600,600]INT8204815360.190.240.43, 0.56, 0.36

Semantic Segmentation

GPUNetworkWidthHeightInference Time (s)Anonymization Time (s)Total Time (s)
Titan RTXpsp resnet 1016407680.20.81.1
Titan RTXpsp resnet 10110247680.30.81.1
Titan RTXpsp resnet 101204810240.91.01.9
Titan RTXpsp resnet 101384021602.03.05.0

Possible Error

Citing

If you use this repository in your research, consider citing it using the following Bibtex entries:

@inproceedings{Tekli2021DesigningAE,
  title={Designing and evaluating anonymization techniques for images and relational data streams via Machine Learning approaches at BMW Group. (Conception et {\'e}valuation de techniques d'anonymisation des images et des flux de donn{\'e}es relationnels via des approches d'apprentissage automatique {\`a} BMW Group)},
  author={Jimmy Tekli},
  year={2021},
  url={https://api.semanticscholar.org/CorpusID:266756928}
}

and

@misc{bmwanotool,
  author = {BMW TechOffice MUNICH},
  title = {BMW Anonymization Tool},
  howpublished = {\url{https://github.com/BMW-InnovationLab/BMW-Anonymization-API}},
  year = {2019},
}

Acknowledgments

Ghenwa Aoun

Antoine Charbel, inmind.ai, Beirut, Lebanon

Roy Anwar

Fady Dib

Jimmy Tekli, BMW Innovation Lab, Munich, Germany

OpenVINO Toolkit

intel.com

robotron.de