November 29, 2020

783 words 4 mins read



A Deep Learning based project for creating line art portraits.

repo name vijishmadhavan/ArtLine
repo link
language Jupyter Notebook
size (curr.) 975 kB
stars (curr.) 168
created 2020-11-23
license MIT License



The main aim of the project is to create amazing line art portraits.

Sounds Intresting,let’s get to the pictures!!



Example Images

bohemian rhapsody movie , Rami Malek American actor


Friends, TV show.


Keanu Reeves, Canadian actor.


Photo by Anna Shvets from Pexels




Alita: Battle Angel


Virat Kohli, Indian cricketer


Taylor Swift, American singer.


Steph Curry and Seth Curry, Basketball


Pexels Portrait, Model


Beyoncé, American singer


Photo by Tim Savage from Pexels



Lets cartoonize the lineart portraits, its still in the making but have a look at some pretty pictures.

Skrillex , American DJ


Tom Hanks, Actor


Line Art

The amazing results that the model has produced has a secret sauce to it. The initial model couldn’t create the sort of output I was expecting, it mostly struggled with recognizing facial features. Even though ( produced great results it had limitations like (frontal face photo similar to ID photo, preferably with clear face features, no glasses and no long fringe.) I wanted to break-in and produce results that could recognize any pose. Achieving proper lines around the face, eyes, lips and nose depends on the data you give the model. APDrawing dataset alone was not enough so I had to combine selected photos from Anime sketch colorization pair dataset. The combined dataset helped the model to learn the lines better.

Movie Poster created using ArtLine.

The movie poster was created using ArtLine in no time , it’s not as good as it should be but I’m not an artist.



Technical Details

  • Self-Attention Generative Adversarial Network ( Generator is pretrained UNET with spectral normalization and self-attention. Something that I got from Jason Antic’s DeOldify(, this made a huge difference, all of a sudden I started getting proper details around the facial features.

  • Progressive Growing of GANs ( Progressive GANS takes this idea of gradually increasing the image size, In this project the image size were gradually increased and learning rates were adjusted. Thanks to for intrdoucing me to Progressive GANS, this helped in generating high quality output.

  • Generator Loss : Perceptual Loss/Feature Loss based on VGG16. (

Surprise!! No critic,No GAN. GAN did not make much of a difference so I was happy with No GAN.

The mission was to create something that converts any personal photo into a line art. The initial efforts have helped to recognize lines, but still the model has to improve a lot with shadows and clothes. All my efforts are to improve the model and make line art a click away.



APDrawing dataset

Anime sketch colorization pair dataset

APDrawing data set consits of mostly close-up portraits so the model would struggle to recogonize cloths,hands etc. For this purpose selected images from Anime sketch colorization pair were used.

Going Forward

I hope I was clear, going forward would like to improve the model further as it still struggles with random backgrounds(I’m creating a custom dataset to address this issue). Cartoonizing the image was never part of the project, but somehow it came up and it did okay!! Still lots to improve. Ill release the cartoonize model when it looks impressive enough to show off.

I will be constantly upgrading the project for the foreseeable future.

Getting Started Yourself

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

Installation Details

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

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


  • Getting great output depends on Lighting, Backgrounds,Shadows and the quality of photos. You’ll mostly get good results in the first go but there are chances for issues as well. The model is not there yet, it still needs to be tweaked to reach out to all the consumers. It might be useful for “AI Artisits/ Artists who can bring changes to the final output.

  • The model confuses shadows with hair, something that I’m trying to solve.

  • It does bad with low quality images(below 500px).

  • I’m not a coder, bear with me for the bad code and documentation. Will make sure that I improve with upcoming updates.


Get more updates on Twitter

Mail me @



All code in this repository is under the MIT license as specified by the LICENSE file.

comments powered by Disqus