Giter Club home page Giter Club logo

style_transfer_part1's Introduction

Style_Transfer_Part1

Introduce

In some tech magazines you may have seen many experiments with style transfer.
Today, I'm going to introduce a very basic but very powerful and useful model call Cycle Gan.
like its name, Cycle Gan is the menber in Gan familly, it has both generator and discriminator as other Gan model, but the most important part and the reason why we call it "cycle" is come from it loss funtion.

image

image
the above funtion is the loss of the origin gan

image

In cycle gan we will add an extra funtion in loss call Cycle-Consistency-loss to make sure the model have enough ability to reconstruct the image, also we will have two generator and two discriminator in the model individually generate different styles. And through the interaction of the generator and discriminator, it just form a circle like function, that why it calls Cycle Gan.

Network Structure

image

(https://hardikbansal.github.io/CycleGANBlog/)

In the generator I used 3 conv2D to down sampling the (256 * 256) image to the (64 * 64) and go through 9 residual block.
Finally, after 3 deconv_block (conv2D + upsampling) the output shape return to 256 * 256.

the special trick in cycleGan is that we use ReflectionPadding2D instead of zero padding to reduce the data loss from convolution, and because in Style Transfer the final result will depend on the specific features ,if we use Batch_norm as the normalization it will actually cause the reduction of feature, so we use InstanceNormalization instead.

Hyperparameters

  • BATCH_SIZE = 2
  • STEP_PER_EPOCH = 250
  • LAMBDA_CYCLE = 10
  • LABEL_IDENTITY = 0.5
  • DROPOUT_RATE = 0.5
  • NUM_RESBLOCK = 9

Data

In this implementation using Van Gogh dataset (https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/)
with 400 Van Gogh painting and 700 real word picture.

Result

image image

image image

References

  1. cycle_gan [arxiv]
  2. tensorflow (https://www.tensorflow.org/tutorials/generative/cyclegan)
  3. keras (https://keras.io/examples/generative/cyclegan/)

style_transfer_part1's People

Contributors

yukino1010 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.