Git Product home page Git Product logo

skindeep's Introduction

waving

SkinDeep   Tweet  

Contact: [email protected]

You can sponsor me to support my open source work 💖 sponsor

Updates

SkinDeep Video is getting ready, thanks to 3dsf (https://github.com/3dsf) for the tremendous effort he has put into this project to make this happen.

post

I planned this project after watching Justin Bieber's "Anyone" Music Video, He had his tattoo covered up with the help of artists airbrushing on him for hours. The results were amazing in the music video. Producing that sought of video output can be difficult, so I opted for Images. Can deep learning do a decent job or can it even match photoshop? This was the starting point of this project!!

Why not photoshop?

Photoshop can produce extremely good results but it needs expertise and hours of work retouching the whole image.

Highlights

Synthetic data generation

To do such a project we need a lot of image pairs, I couldn't find any such dataset so I opted for synthetic data.

(1) Overlaying APDrawing dataset image pairs along with some background removed tattoo designs, This can be easily done using Python OpenCV.

(2) Apdrawing dataset has line art pairs which will mimic tattoo lines, this will help the model to learn and remove those lines.

(3) APDrawing dataset only has portrait head shots, For full body images I ran my previous ArtLine(https://github.com/vijishmadhavan/ArtLine) project and overlaid the output with the input image.

Imgur

Imgur

(4) ImageDraw.Draw was used with forest green colour codes and placed randomly on zoomed-in body images, Similar to Crappify in fast.ai.

(5) Photoshop was also used to place tattoos in subjects where warping and angle change was needed.

Imgur

Mail me for a modified Apdrawing dataset.

Example Outputs

Imgur

Imgur

Imgur

Heavily tattooed faces

Imgur

Imgur

Visual Comparison

Imgur

Technical Details

The highlight of the project is in producing synthetic data, thanks to pyimagesearch.com for wonderful blogs. Check below links.

https://www.pyimagesearch.com/2016/03/07/transparent-overlays-with-opencv/

https://www.pyimagesearch.com/2016/04/25/watermarking-images-with-opencv-and-python/

https://www.pyimagesearch.com/2015/01/26/multi-scale-template-matching-using-python-opencv/

Required libraries

This project is built around the wonderful Fast.AI library.

  • fastai==1.0.61 (and its dependencies). Please don't install the higher versions
  • PyTorch 1.6.0 Please don't install the higher versions

Getting Started Yourself

The project is still a work in progress, but I want to put it out so that I get some good suggestions.

The easiest way to get started is to simply try out on Colab:

The output is limited to 500px and it needs high quality images to do well.

I would request you to have a look at the limitations given below.

Docker

Note: These instructions are for running with an NVDIA GPU on Linux.

Prequisites

  • Make sure your NVIDA drivers are correctly installed. Running nvidia-smi should confirm your driver version and memory usage
  • Approximately 3.7GB of free GPU memory
  • The nvidia-docker2 package installed. This will allow the Docker container access to the GPU
  • Docker installed with the correct permissions for your system

Run the container

This runs against all of the GPUs. Check the Docker documentation for running on a specific card if you have multiple.
The type=bind mounts the current directory (where you checked out the project) as the home in the container. This allows you immediate access to the notebooks.

$> docker run --gpus all \
              --mount type=bind,source=`pwd`,target=/home/jovyan \
              -d \
              -p 8888:8888 -p 4040:4040 -p 4041:4041 \
              jupyter/tensorflow-notebook:python-3.8.8

Launch the site

Use 'ps' to get the id of your new container, then print out the logs to get the launch URL. This is required because an authenication token is created at startup.

$> docker ps
$> docker logs <container_id>

Limitations

  • Synthetic data does not match real tattoos, so the model struggles a bit with some images.
  • Building a huge dataset by myself was impossible, so I had to go with a limited number of image pairs.
  • Tattoo designs are unique, it differs from person to person so the model might fall in some cases.
  • Coloured tattoos won't work, the dataset had none.

Going Forward

The model still struggles and needs a lot of improvement, if you are interested please contribute lets improve it.

Acknowledgments

skindeep's People

Contributors

3dsf avatar amrzv avatar kozobot avatar vijishmadhavan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skindeep's Issues

colab link not working

Here is the stacktrace for failing step 3, it can't proceed later

!pip install -r colab_requirements.txt
Collecting fastai==1.0.61 (from -r colab_requirements.txt (line 1))
  Using cached fastai-1.0.61-py3-none-any.whl (239 kB)
Collecting numpy==1.17.2 (from -r colab_requirements.txt (line 2))
  Using cached numpy-1.17.2.zip (6.5 MB)
  Preparing metadata (setup.py) ... done
Collecting pandas==1.1.2 (from -r colab_requirements.txt (line 3))
  Using cached pandas-1.1.2.tar.gz (5.2 MB)
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Dataset size

How many dataset have you used for training the model ?
What is the image size? Do we have to resize image to 64 ? Is it possible for you to share your dataset?

dataset

would you share your dataset please?

Extending this to other ideas

This is awesome, thank you for putting this together. If I wanted to extend this basic idea to other use cases (i.e. removing a logo from a car) how would I go about that? I can get both the "before" and "after" pictures of the car for training.

How does dataset look lile?

@vijishmadhavan This project is helpful for me, but I don't know how the dataset looks like, does it look like this:
path_hr = Path('image without tattoo')
path_lr = Path('image with tattoo')

Thanks for your kind reply.

General Questions

Hi, I've finally gotten this working on my pc, and it's good, not great.....pretty impressive though.

  1. the image sizes are bad.......if you put in a portrait photo, the ideal situation would be not a 400px X 400px square.....we'd want ie the same image size, with the tattoos removed, in portrait / landscape etc.......where abouts in the code do we change this, or is this a function of the actual skindeep2.pkl?

  2. How do we add our own data to the skindeep2.pkl , is this possible or do we have to start off with another one of our own? How do we make a dataset if we already have the images ready to go

  3. it occasionally removes ie peoples shoes, or eyes, or half their face (no tattoos), is this being worked on? It's very cool though, I just thought I'd see if the developer would be available to maybe give us abit of help if we wanted to try to improve this......I work for hours removing tattoo's with photoshop, and even if I got this to ie do a layer to add back into photoshop, to help my work flow.....

Thanks in advance

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.