Code Monkey home page Code Monkey logo

sketchkeras's Introduction

sketchKeras

An u-net with some algorithm to take the sketch from a painting.

requirement

  • Keras
  • Opencv
  • tensorflow/theano
  • numpy

download mod

see release

performance

Currently there are many edge-detecting algrithoms or nerual networks. But few of them has good performance on paintings, espatially those from comic or animate. Most of these existing methods just detect the edge and then add lines to the edge. However, we need a method to convert the painting to a sketch which looks like a painter drawed the outline of picture. It is important when we want to train a nerual networks to colorlize pictures.(Paper is on the way)

Here is a example of artificial sketch for reference.

goal

Here is a conclusion of existing methods to handle this problem.

  • use opencv and implement a high-pass effect to get the edge
  • train a nerual network (HED Edge Detect)/(PaintsChainer's lnet)
  • use this sketchKeras which combined algorithm and nerual networks

Take this pic as an example (Picture is from internet and I am finding the author.)

pic

If we use the high-pass algorithm via opencv or something else, we may get this one:

pic

As we can see, the result is far from artificial sketch. To achieve better performance, we may modify the parameters and enhance the pic, then it comes this one:

pic

The result is still not good. People like to add shadow to their drawing by add dense lines or points and these will become noise and disturb the high-pass algorithm. It is apprent that we can modify the parameters or use denoise methods to improve it, but drawings differ from one another and it is impossible to handle these automatically.

Then let us try the lnet of PaintsChainer (similar to HED)

pic

The result from nerual networks looks different from those from algorithm. However, this is still not so good. The author of PaintsChainer use threslod to avoid noise and normalize the line, as this:

pic

In this picture, we can see clearly that the noise, espeacilly near eyes and in the shadow of hair. "threslod" can filter some noise but some useful lines is also dropped. Last but not least, the lines are too coarse and thick. Here is a reference of thresloded artificial sketch:

pic

As we can see, though the picture is denoised by "threslod", it differs far from real artificial sketch. So it remains much improvement place in paintsChainer.

Finally, let us see the result of sketchKeras:

pic

pic

pic

pic

The four results are generated by sketchKeras. You can use your favorite one to generate your own training dataset for colorize networks.


another example

(picture is from internet and I am finding the author.) raw picture:

pic

opencv and high-pass (all detail and noise remained so it is not suitable for training a colorize network)

pic

opencv and high-pass enhanced (still not so good and we can see the pic is going to become a grayscaled detailed pic but not a sketch)

pic

paintsChainer's lnet (all detail and noise remained, espcially the hair)

pic

paintsChainer's lnet (thresloded) (just look at the hair)

pic

Pics below are generated by sketchKeras. It can drop some noise and unimportant detail to achieve better performance.

pic

pic

pic

ability to generate colored highlighted sketch

As you can see, sketchKeras has the ability to generate colored highlighted sketch.

pic

sketchkeras's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sketchkeras's Issues

你好

不好意思,
我是剛從PaintsChainer 的issue 連接過來的, 你的項目很有趣, 可以加個好友嗎?

What is the training procedure?

Can you briefly describe the dataset and training loss/algorithm used for the "sketchifying" neural network? I couldn't find any comments after reading this repo, paintschainer and your style2paints repo and paper. Many thanks.

Training data and u-net architecture

Hi, your u-net architecture works very well. Would you mind sharing the training data(or how to collect this data) and your u-net architecture?

Thank you!

why input shape is (None, 512, 512, 1)?

I load the mod and print mod.InputLayers[0].input_shape and get the (None, 512, 512, 1).
But the code in main.py indicates that the input shape should be [None, 512, 512, 3] or [3, 512, 512, None] depending on the data format.
When I feed [3, 512, 512, batch_size] or [batch_size, 512, 512, 3] to mod.predict, Exception is raised.
Can you help me ? What's going on here?

How to retain image original size?

I have been using this to convert a video into sketch animation but each image is resized into smaller image thus cannot retain quality. How can I retain image original size?

low-pixel image handling

I tried this method and here are my results:

Original

000000

After "sketched"

sketchkeras
sketchkeras_pured
sketchkeras_enhanced
sketchkeras_colored

Can you give a hint on what's your training sets look like? Thank you.

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.