systemerrorwang / cartoongan Goto Github PK
View Code? Open in Web Editor NEWTensorflow inplementation of CartoonGAN
Tensorflow inplementation of CartoonGAN
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?
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
.
I have tried to implement tflite file in android code as below, but image output not generated well
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)
}
}
}
outputByteBuffer!!.rewind()
interpreter!!.run(inputByteBuffer, outputByteBuffer)
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
}
Hi, may I ask if the code on GitHub can run the effect you mentioned below?
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)
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!
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.
i want implement the code you write.can i get the dataset link
ou also need to download a pre-trained vgg19 model and locate in in the save folder. (https://mega.nz/#!xZ8glS6J!MAnE91ND_WyfZ_8mvkuSa2YcA7q-1ehfSm-Q1fxOvvs)
URL can't open~
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.
We can cartoonize videos with that gan ?
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
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
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)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.