Real-time video stream censor. The project combines OBS script and mobilenet model for real-time NSFW classification of the video stream captured from display source. In case of inappropriate imagery detection, the script tells OBS to blur recording.
Small demonstration of how it works. (Recording looks a little bit weird because it was done on gcloud VM):
https://www.youtube.com/watch?v=mGjkkCDoM00
https://www.youtube.com/watch?v=5ktVHWu-jgc&t=57s
- Tensorflow
- Python 3.6+
- OBS Studio
- OBS Studio
- Python 3.6+
- GPU version of Tensorflow
- NVIDIA® GPU card with CUDA® Compute Capability 3.5 or higher. See the list of CUDA-enabled GPU cards
- Download python 3.6+
- Install Tensorflow
- Clone or download this repository
- Install dependencies:
$ pip install -r /path/to/requirements.txt
- Add python path to OBS and upload script.
- Create new display source, crop the exact region you want to monitor on the underlying source and apply blur to it
- Streameffects https://obsproject.com/forum/resources/stream-effects.578/
- Resize filter https://www.youtube.com/watch?v=8PODw_nHUbQ
You can do either way, it shouldn't really matter since the source will be disabled most of the time.
Before desktop screenshot is fed to classifier it is resized to 224x224 pxl ratio. Obviously, a lot of features of the image are lost due to compression. In this case, the smaller initial screen region the better will be quality of the resized image and prediction accuracy.
- Configure scripts settings:
Setting | Description |
---|---|
Prediction threshold | How "sure" algorithm should be in order to classify something as NSFW. If the value is to low there will be a lot of noise and false positives, if too high it may not detect problematic recording. |
Monitor number | Number of the display source monitor, as spesified in os settings. |
Port | Socket port |
Quiry interval(ms) | How often should obs script update "blur status", depends on speed of a classifier. |
Blur Source | Name of the display source used to blur recording. |
- Disable source
- Run classifier.py
$ python path/to/classifier.py -v --port=5557