GithubHelp home page GithubHelp logo

colorize's Introduction

Sketch colorization using Pix2Pix

Original paper: Image-to-Image Translation with Conditional Adversarial Networks

Dataset used for training: https://www.kaggle.com/datasets/ktaebum/anime-sketch-colorization-pair

Colorization is the one of the basic GAN tasks. This specific domain however introduces a tricky challenge: color palette tends to be very non-uniform, defined by the certain character design, or (in the cases of OC) limited only by the artist's imagination.

To address the issue without diverging from the original paper much, we'll be extracting the colormap from the image and pass it to the generator bottleneck. Given no colormap, it will be sampled from a uniform random distribution.

Though the original dataset comes with JSON colormaps, we decided to make the approach more flexible and extract colormaps as we go. Current implementation extracts 8 prevalent colors, it also allows to supply a reference color image. Though this is an imperfect solution (it breaks fully convolutional translation, and undithered extraction quality is questionable), this is about as far as we can go without major changes to the architecture.

Additionally, the model will be trained and tested on a stock task from the original paper (all the stock datasets: https://www.kaggle.com/datasets/vikramtiwari/pix2pix-dataset),

Required units:

  • PyTorch
  • Albumentations
  • ๐Ÿค— accelerate
  • Pillow
  • colorgram.py
  • NumPy
  • Matplotlib
  • tqdm

Contains:

  • An illustrated notebook with the complete code: colorize-final.ipynb.
  • An importable unit implementation (mygan directory), complete with the simple examples (train.py and run.py).
  • A django app, including the minimal generator implementation. Running live at https://pool.animeco.in/apps/colorize/

Download pretrained weights: generator, discriminator.

Commandline interface:

  • compatible with any dataset akin to mentioned above (source and target stacked into a single image);
  • adjust the settings in the config.py;
  • train.py needs no additional arguments;
  • run.py accepts two commandline arguments: source file and an optional color reference file.

Additional django app info:

  • app templates should be enabled;
  • running torch applications via Apache WSGI requires WSGIApplicationGroup %{GLOBAL}. CPU is fine, colorgram extraction takes longer than a generator run.

Jan 31st update:

  • Added target on right support (e.g. edges2shoes). Pretrained weights for edges2shoes: generator, discriminator.

colorize's People

Contributors

dx2-66 avatar caraphinneth avatar

Watchers

 avatar

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.