DeepDYE is a deep learning model to dye hair un photographs using neural networks.
- Process the image with segmentation model based on U-Net to locate the hair area.
- Color the hair area with the desired color.
- Merge the images with a soft-light blend mode.
Soft-light blend is powered by https://github.com/flrs/blend_modes
- Clone the repo
git clone https://github.com/alcros33/DeepDYE
- Make a virtual env and install the requirements
virtualenv .env
source .env/bin/activate
pip install Pillow opencv-python
- Follow the instructions to install Pytorch, then install torchvision and fastai
# https://pytorch.org/get-started/locally/
pip install torchvision
pip install fastai
- Download the model and place it inside the folder
Models
https://drive.google.com/open?id=10AfHydtWC1rtEyvjyMR9ue02aBsQU5Vv
python DeepDYE.py Image.jpg [red|green|blue|pink] -o ImageOut.png
You can train the model yourself by following the steps on the jupyter notebook included in the repo. HairSeg.ipynb