<br />
<p align="center">
<h3 align="center">DashcamCleaner</h3>
<p align="center">
This tool allows you to automatically censor faces and number plates on dashcam footage.
<br />
<a href="https://github.com/tfaehse/DashcamCleaner/issues">Report Bug</a>
·
<a href="https://github.com/tfaehse/DashcamCleaner/issues">Request Feature</a>
</p>
</p>
<!-- TABLE OF CONTENTS -->
<details open="open">
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation-example-on-windows-using-conda">Installation example on Windows using Conda</a></li>
</ul>
</li>
<li>
<a href="#usage">Usage</a>
<ul>
<li><a href="#desktop">Desktop</a></li>
<li><a href="#cli">CLI</a></li>
<li><a href="#container">Container</a></li>
</ul>
</li>
<li><a href="#weights">Weights</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgements">Acknowledgements</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## About The Project
This project is a result of data protection laws that require identifiable information to be censored in media that is posted to the internet. Dashcam videos in particular tend to be fairly cumbersome to manually edit, so this tool aims to automate the task.
The goal is to release a simple to use application with simple settings and acceptable performance that does not require any knowledge about image processing, neural networks or even programming as a whole on the end user's part.
Development started with an MVP using understand.ai's [Anonymizer](https://github.com/understand-ai/anonymizer) for its backend. Since then, the project has moved on to a custom-trained [YOLOv8](https://github.com/ultralytics/ultralytics) network. I wrote about my experiences training the network and generating training data on [Towards Data Science](https://towardsdatascience.com/making-dashcam-videos-gdpr-compliant-f9832883fe94).
<!-- GETTING STARTED -->
## Getting Started
To get a local copy up and running follow these simple steps.
### Prerequisites
You need a working Python environment with a Python version of 3.8 or higher that satisfies the listed `requirements.txt`. Depending on your machine, you can leverage GPU acceleration for pytorch - see [here](https://pytorch.org/get-started/locally/).
Since OpenCV does not care about audio channels, ffmpeg is used to combine the edited video and the audio channel of the input video. The environment variable `FFMPEG_BINARY` needs to be set to the ffmpeg executable for this to work.
### Installation example on Windows using Conda
1. Clone the repo
```sh
git clone https://github.com/tfaehse/DashcamCleaner.git
```
2. Set up Python environment and install requisites
```sh
conda create -n py38 python=3.8
conda activate py38
pip install -r requirements.txt
```
3. Install ffmpeg binaries (release essentials is enough) and create an environment variable "FFMPEG_BINARY" that points to the ffmpeg.exe binary.
<!-- USAGE EXAMPLES -->
## Usage
On first launch, the YOLOv8 model is automatically downloaded and fused with the custom weights for face and plate detection from this repo.
![UI screenshot](img/ui_screenshot.png "Screenshot of the UI")
The UI is fairly self-explanatory: To use the tool, you need to:
- choose an input video file
- choose an output location
- hit start!
The options adjust parameters of the detection algorithm and post-processing options laid out in [the roadmap](Roadmap). The detection threshold and inference size are direct parameters of the YOLOv8 detector, they provide the main controls for detection quality and speed that can be tweaked. In short:
- Each recognized object, i.e. a face or a license plate, possesses a confidence value that describes how likely it is to actually be a license plate or a face. Increasing the threshold results in fewer false positives, at the cost of potential false negatives
- The performance of the detector depends on the input size of the image, so the resolution of the video. The inference size option allows downscaling the input for detections only. The result is faster detection with reduced precision. _NOTE:_ The output video still uses the full resolution from the input video, there is no loss in quality! Only detection runs at a lower resolution.
The blur size determines how strongly detected faces and license plates are blurred. Boxes around faces and license plates can be enlarged by a factor between 0.8 and 10 using the ROI enlargement dial.
Sometimes, a license plate might be missed for just one frame. This one frame, usually 1/30th of a second long, still means the license plate or face could easily be identified - a computationally very cheap (as opposed to increasing the inference scale) way to fix such false negatives can be the frame memory option. In essence, it blurs not only the detected boxes in the current frame, it also blurs regions that were detected in __n__ frames before. Especially in combination with ROI enlargement and videos without very quick movement, this method can hide away missed detections.
For reference: even at 1080p inference, i.e. an inference scale of 1, a 1080p30fps video from my 70mai 1S processes at around 10 frames per second, a 1 minute clip takes ~3 minutes to blur on a 5820K/GTX1060 machine.
# CLI
There's now also a fairly simple CLI to blur a video:
```
usage: cli.py -i INPUT_PATH -o OUTPUT_PATH [-w WEIGHTS] [-bw BLUR_WORKERS] [-s [1, 1024]] [-b [1, 99]] [-t [0.0, 1.0]] [-r [0.0, 2.0]] [-q [1.0, 10.0]] [-fe [0, 99]] [-nf] [-bm [0, 10]] [-m] [-mc] [-j] [-h]
This tool allows you to automatically censor faces and number plates on dashcam footage.
required arguments:
-i INPUT_PATH
--input_path INPUT_PATH
Input video file path. Pass a folder name for batch processing all files in the folder.
-o OUTPUT_PATH
--output_path OUTPUT_PATH
Output video file path. Pass a folder name for batch processing.
optional arguments:
-w WEIGHTS (Default: 720p_medium_mosaic)
--weights WEIGHTS
Weights file to use. See readme for the differences. (default = 720p_medium_mosaic).
-bw BLUR_WORKERS (Default: 2)
--blur_workers BLUR_WORKERS
Amount of processes to use for blurring frames. (default = 2)
-b [1, 99] (Default: 9)
--blur_size [1, 99]
Kernel radius of the blurring-filter. Higher value means more blurring, 0 would mean no blurring at all.
-t [0.0, 1.0] (Default: 0.4)
--threshold [0.0, 1.0]
Detection threshold. Higher value means more certainty, lower value means more blurring. This setting affects runtime, a lower threshold means slower execution times.
-r [0.0, 2.0] (Default: 1.0)
--roi_multi [0.0, 2.0]
Increase or decrease the area that will be blurred - 1.0 means no change.
-q [1.0, 10.0] (Default: 10)
--quality [1.0, 10.0]
Quality of the resulting video. higher = better. Conversion to crf: ⌊(1-q/10)*51⌋.
-fe [0, 99] (Default: 5)
--feather_edges [0, 99]
Feather edges of blurred areas, removes sharp edges on blur-mask.
Expands mask by argument and blurs mask, so effective size is twice the argument.
-nf (Default: False)
--no_faces
Do not censor faces.
-bm [0, 10] (Default: 0)
--blur_memory [0, 10]
Blur detected plates from n previous frames too in order to (maybe) cover up missed identifiable information
没有合适的资源?快使用搜索试试~ 我知道了~
yolov8系列--Censor identifiable information in videos, in pa.zip
共30个文件
py:10个
pt:8个
txt:2个
需积分: 5 0 下载量 85 浏览量
2024-02-24
21:46:47
上传
评论
收藏 167.87MB ZIP 举报
温馨提示
yolov8系列--Censor identifiable information in videos, in pa
资源推荐
资源详情
资源评论
收起资源包目录
yolov8系列--Censor identifiable information in videos, in pa.zip (30个子文件)
kwan1120
.flake8 101B
dashcamcleaner
__init__.py 0B
weights
720p_small_v8.pt 21.55MB
720p_nano_v8.pt 6.03MB
360p_small_v8.pt 21.46MB
1080p_nano_v8.pt 6.17MB
1080p_small_v8.pt 21.69MB
1080p_medium_v8.pt 49.83MB
720p_medium_v8.pt 49.69MB
360p_nano_v8.pt 5.95MB
main.py 9KB
src
__init__.py 0B
blurrer.py 10KB
detection.py 676B
bounds.py 3KB
ui_mainwindow.py 11KB
generate_training_data.py 15KB
mainwindow.ui 9KB
qt_wrapper.py 6KB
cli.py 10KB
.github
workflows
docker-image.yml 1KB
LICENSE.txt 34KB
.isort.cfg 54B
.pre-commit-config.yaml 957B
.pep8 49B
img
ui_screenshot.png 314KB
Dockerfile 403B
requirements.txt 356B
.gitignore 40B
README.md 13KB
共 30 条
- 1
资源评论
Kwan的解忧杂货铺
- 粉丝: 2w+
- 资源: 3699
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功