Giter Site home page Giter Site logo

cartoongan's People

Contributors

systemerrorwang avatar

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

cartoongan's Issues

some question about face training

when I train cartoongan(use face images and real_world images), some strange color appear on the face. And in cartoon face images, big eyes are usual.Can you give me some advice?

there is a problem!

Traceback (most recent call last):
File "main.py", line 208, in
main()
File "main.py", line 198, in main
model.build_model()
File "main.py", line 64, in build_model
name='discriminator', reuse=False)
File "/export/home/lxy/CartoonGAN/model.py", line 106, in patch_discriminator
conv1 = slim.conv2d(patch, 32, [3, 3], activation_fn=None)
File "/export/home/anaconda2/envs/python36/lib/python3.6/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
return func(*args, **current_args)
File "/export/home/anaconda2/envs/python36/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1033, in convolution
outputs = layer.apply(inputs)
File "/export/home/anaconda2/envs/python36/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 671, in apply
return self.call(inputs, *args, **kwargs)
File "/export/home/anaconda2/envs/python36/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 559, in call
self.build(input_shapes[0])
File "/export/home/anaconda2/envs/python36/lib/python3.6/site-packages/tensorflow/python/layers/convolutional.py", line 132, in build
raise ValueError('The channel dimension of the inputs '
ValueError: The channel dimension of the inputs should be defined. Found None.

Android Code Implementation

I have tried to implement tflite file in android code as below, but image output not generated well

Preprocess image

private fun preprocess(bitmap: Bitmap) {

    bitmap.getPixels(this.pixelValues, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height)
    this.inputByteBuffer!!.rewind()
    for (row in 0 until this.inputSize!!.getHeight()) {
        for (col in 0 until this.inputSize!!.getWidth()) {
            val pixel = this.pixelValues!![row * this.inputSize!!.getWidth() + col]
            this.inputByteBuffer!!.putFloat( ( (pixel shr 16 and 255).toFloat()  - 127.5f) / 1.0f)
            this.inputByteBuffer!!.putFloat( ( (pixel shr 8 and 255).toFloat()  - 127.5f) / 1.0f)
            this.inputByteBuffer!!.putFloat( ( (pixel and 255).toFloat()  - 127.5f) / 1.0f)
        }
    }
}

Run model

outputByteBuffer!!.rewind()
interpreter!!.run(inputByteBuffer, outputByteBuffer)

Post process image

private fun postprocess(): IntArray {

    val width = this.inputSize!!.getWidth()
    val height = this.inputSize!!.getHeight()
    val output = IntArray(width * height)
    this.outputByteBuffer!!.rewind()
    for (row in 0 until height) {
        val rowOffset = row * width * 3 * 4
        for (col in 0 until width) {
            val colOffset = col * 3 * 4
            val rValue = this.outputByteBuffer!!.getFloat(rowOffset + colOffset)
            val gValue = this.outputByteBuffer!!.getFloat(rowOffset + colOffset + 4)
            val bValue = this.outputByteBuffer!!.getFloat(rowOffset + colOffset + 8)
            val v1 =  ((rValue.toInt() and 255 shl 16)  ) + 127.5f
            val v2 =  ( (gValue.toInt() and 255 shl 8)  ) + 127.5f
            val v3 =   ((bValue.toInt() and 255)  ) + 127.5f
            val pixel =
                -16777216 + v1 + v2 + v3
            output[row * width + col] = pixel.toInt()
        }
    }
    return output
}

Image output

image

Code running effect

Hi, may I ask if the code on GitHub can run the effect you mentioned below?

Model architecture conversion

Hey Mr.Wang,
I read the Cartoonization paper of yours and also followed the code.
It was great! and I was trying to implement it independently.
This led me to your citation page which I opened the support pdf.

I've few doubts about the generator part(i tried making the code to the point I understood)

link to my Github repo

I faced problems in the residual block part.
do we first take the convolution of the blue box(hence making it pink) and add it to the output of the previous block.
or add the blue block's output to that of previous and take the convolution in pink.

waiting eagerly for your reply!

License

Hello, please could you add a license for this project.

I plan on using this project for an application, but I'm kind of lost on if I'm allowed to use this project or not.

Thank you.

Hello, some questions about CartoonGAN

Hi, I'm also reproducing Cartoongan, but I can't get smooth effect, just some change of color. can you get it? How about your result? I did it according to the point of the paper.

Error using colab

hello, im trying the "!python cartoonize_random_size.py"
i got this error:

Traceback (most recent call last):
File "cartoonize_random_size.py", line 82, in
cartoon_image = cartoonize(image_path, weight_path)
File "cartoonize_random_size.py", line 63, in cartoonize
weight = np.load(weight_path)
File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 453, in load
pickle_kwargs=pickle_kwargs)
File "/usr/local/lib/python3.6/dist-packages/numpy/lib/format.py", line 722, in read_array
raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

I'm waiting your paper....

first...i'm sorry my late reply for your help about the free size cartoonize...
it worked fine and got original image size cartoonized product...thanks...

cartoongan is very interesting........and your result is the finest image ever i saw in cartoongan applied.

i'm waiting your paper.....post up here your paper...thanks in advance

How can i get 1280*720 cartoonganed image using your code?

Hi SystemErrorWang ~~
First of all, thanks for sharing your valuable code & result with github.
I tried my sample image 1270*720 and I get 256 * 256 sized image as your code says.
But, your new result image is not 256 * 256 maybe. how can get large image like your new result?

thanks

!

Traceback (most recent call last):
File "main.py", line 208, in
main()
File "main.py", line 200, in main
model.train()
File "main.py", line 129, in train
photo_batch = utils.next_batch(self.batch_size, self.image_size, self.celeba_list)
File "/export/duoduo/lxy/CartoonGAN/utils.py", line 76, in next_batch
return np.asarray(batch_data)
File "/export/duoduo/anaconda2/lib/python2.7/site-packages/numpy/core/numeric.py", line 492, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: could not broadcast input array from shape (96,96,3) into shape (96)

Detail about the dataset and hyper-parameter

Hi, Thank you for amazing CartoonGAN implementation,
I'm reproducing CartoonGAN, but don't get the good result.
Can your share how many real and cartoon images in your dataset. And during the training, the weight of vgg loss, learning rate and batch_size that you using. Is it like in the your old_code folder?
Thanks you so much.

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.