The world’s leading publication for data science, AI, and ML professionals.

Remove Body Tattoo Using Deep Learning

Just need 5 minutes of your time, photoshop is nowhere in the race here

Photo by Tima Miroshnichenko from Pexels
Photo by Tima Miroshnichenko from Pexels

Deep Learning is interesting and it is my favorite area of research. I really like to play with new research development that deep learning practitioners are doing. I just came across an amazing GitHub repo from one of my fellow mates on the Computer Vision group. I like it so much that think of sharing it with you all.

The GitHub repo is based on GANs (Generative Adversarial Network) model. It can remove any kind of tattoo from body parts.

I will walk you through the step-by-step process of how you can utilize the same repo using your own image.


Launch Google Colab

Google Colab provides us free GPU power to run or train our Deep Learning models in less amount time. And the good thing is that it is free.

Type the below URL in the browser and press enter

https://colab.research.google.com/
By Author
By Author

After launching sign in with your Google account. If you have google already signed in it will just pick the primary account to sign in. No worries! Your data is safe here.

After login, go to file and open a new notebook.

By Author
By Author

Clone GitHub Repo

Now, we have to run the below command in the notebook that we have just created.

!git clone https://github.com/vijishmadhavan/SkinDeep.git SkinDeep
By Author
By Author

This command will clone the GitHub code in your colab environment.

Now, for the next step, we have to utilize the cloned repo. To do that run the following command in the next cell of the notebook.

cd SkinDeep

Installing the libraries

Run the following command in the next cell to install all the necessary libraries.

!pip install -r colab_requirements.txt
By Author
By Author

Defining Model Architecture

Now, It’s time to initialize the model architecture. The architecture is available in the same GitHub repo that we have cloned.

Run the following code in the next cell to initialize the model.

Loading Model File

Once, the model is initialized, we can download the pre-trained GANs model for tattoo removal. Run the following commands in the next cell for the same.

MODEL_URL = "https://www.dropbox.com/s/vxgw0s7ktpla4dk/SkinDeep2.pkl?dl=1"
urllib.request.urlretrieve(MODEL_URL, "SkinDeep2.pkl")
path = Path(".")
learn=load_learner(path, 'SkinDeep2.pkl')

Defining Input Image

Finally, it is the time when you can define your input image that you want to test. Replace your image URL in the below code segment.

Testing the model & getting results

Now comes the interesting part. Let’s run the model and get the answer. Run the below lines of code in the next cell.

p,img_hr,b = learn.predict(img_fast)
Image(img_hr).show(figsize=(8,8))
By Author
By Author

Conclusion

That’s all for this article. We have discussed the step-by-step live use of the SkinDeep model to remove tattoos from your skin.

Thanks for reading! Stay connected.

References

vijishmadhavan/SkinDeep


Related Articles