Coder Social home page Coder Social logo

faceblur_container's Introduction

Faceblur Container

This faceblur container repository makes it easy to build a fully contained docker image for applying a face blur on video files. It uses the RetinaFace neural network in the backend. The repository is based on the Pytorch_faceblur code.

Building the image

Download the trained weights file Resnet50_Final.pth from Kaggle and place it in the top folder of this repository.

Run the docker-build.sh script. Building the image may take a while the first time because the base images need to be downloaded as well.

Running the container

docker run -it --rm -v $(pwd):/work faceblur videoblur.sh --input_file video.mp4 --output_file video_blur.mp4 --cpu --blur_strength 0.8

With GPU support:

docker run --gpus all -it --rm -v $(pwd):/work faceblur videoblur.sh --input_file video.mp4 --output_file video_blur.mp4 --blur_strength 0.8

Remove the -it to run it in daemon mode (without interaction).

This will mount your working folder pwd to the docker image and process the given video file, located relatively to your working folder. The blur strength usually ranges from 0.3 (not very blurred), to 0.4 (average blur), to 0.6 (a lot of blur), though any number beteen 0.0 and 1.0 can be used.

Check that the exit code is zero to make sure the algorithm finished sucessfully:

retVal=$?
if [ $retVal -ne 0 ]; then
    echo "!!!"
    echo "!!! video file not processed correctly => manually check what happened !!!"
    echo "!!!"
fi
exit $retVal

You may want to re-encode the resulting video to compress it or change the codec, using:

docker run -it --rm -v $(pwd):/work faceblur ffmpeg -i video_blur.mp4 -vcodec libx264 -crf 23 video_blur_enc.mp4

References

faceblur_container's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.