Skip to content

mayank26saxena/portrait-mode

Repository files navigation

Portrait Mode

This project implements the portrait mode effect on images using Neural Networks.

How it works?

Traditionally, the portrait mode effect has been achieved using 2 lenses which detect objects present in the foreground and in the background. With advances in the field of ML, this effect can also be implemented using only image segmentation. Using the pretrained DeepLab-v3+ open source model, we can find the objects in the foreground of the image and blur the background to replicate this effect.

Check out the demo website - Demo (Source Code: https://github.com/mudit9/portraitmode-flask)

Setup

This project relies on a handful of dependencies, use the following command to install your dependencies:

pip install -r requirements.txt

Note: Depending on your environment, you may need to use sudo. You may also want to use virtualenv.

Usage

Portrait Mode Effect is used from the command line:

python portrait-mode.py -i samples/input-1.jpg

-i/--image: specifies the image file.

The script outputs one image in the same directory with the name: input-1-portrait.jpg

Examples

python portrait-mode.py -i samples/input-1.jpg

python portrait-mode.py -i samples/input-2.jpg

python portrait-mode.py -i samples/input-3.jpg

To Do

  • Develop API.
  • Develop website.

Developers

This project has been developed by:

License

MIT License - see the LICENSE file for details.

Credits

  1. https://ai.googleblog.com/2018/03/semantic-image-segmentation-with.html
  2. https://github.com/tensorflow/models/tree/master/research/deeplab
  3. https://github.com/minimaxir/person-blocker

About

Implementing Portrait Mode Effect using Neural Networks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages