Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdamOptimizer and scope problem #2

Open
phoenix1992 opened this issue Oct 24, 2017 · 15 comments
Open

AdamOptimizer and scope problem #2

phoenix1992 opened this issue Oct 24, 2017 · 15 comments

Comments

@phoenix1992
Copy link

Hello, i have run the code and got a error information. It is about Adamoptimizer. It can not work under "reuse=True" condition. I am a new beginner about tensorflow. Could you help me to solve it?
Thank you

@timzhang642
Copy link
Owner

This code was implemented with Tensorflow 1.1, check your TF version and see if they match. If not, there might be minor adjustment need to be made in order to make it work.

If possible, try provide more details of the error.

@phoenix1992
Copy link
Author

Thank you for your reply. I have solved the problem by adding a command as below :
with tf.variable_scope(tf.get_variable_scope())

Though i have trained the 3D GAN model successuflly, the chair i generated is wrong, it seems that i generate a cube. I have noticed that the generator contains four layers, h0(fc)-h1(deconv)-h2(deconv)-h3(deconv). I am confused if it is the full definition of the generator in this 3D GAN model or just part of it? Hope for your reply.

@timzhang642
Copy link
Owner

The generator structure should work fine.

For how long your have trained the model? Usually the generated data looks randomly scattered in the 3D space in the first few epochs.

@phoenix1992
Copy link
Author

About 9 hours. The result i got seems like a cube, with dense points.
I have used the training epochs in your code. Training epochs = 20001, and then continue training for epoch in range (4000, 25001).
Actually, I have not changed the code and just run it. I am confused with the chair i generated.
Thank you so much.

@phoenix1992
Copy link
Author

The train samples that generated during training are [64,32,32,32] arrays. I am confused about it. Should it be [64,64,64] array that represents a chair? The output of generator is [64,32,32,32] array?

@phoenix1992
Copy link
Author

@timzhang642 Dear Tim, i have found that i used generator1 can work. I am appreciate for your suggestion. Thank you.

@timzhang642
Copy link
Owner

64 means there are 64 chairs in this training batch.
The train samples that generated during training are [64,32,32,32] arrays. I am confused about it. Should it be [64,64,64] array that represents a chair? The output of generator is [64,32,32,32] array?

@springfall2018
Copy link

Hello tim,

I tried to run the code but get the error:

----> 8 train_chairs=train_chairs.reshape([988,32,32,32,1]) # turn train_chairs into 5D tensor [batch, depth, height, width, channels]

ValueError: cannot reshape array of size 851968 into shape (988,32,32,32,1)

How do I fix it?

@timzhang642
Copy link
Owner

I my case, I had 988 instances in train_chairs; In your case, looks like you only have 851968/32/32/32 = 26 instances. So change it to train_chairs=train_chairs.reshape([26,32,32,32,1]).

@springfall2018
Copy link

springfall2018 commented Nov 30, 2018 via email

@springfall2018
Copy link

springfall2018 commented Dec 1, 2018 via email

@springfall2018
Copy link

springfall2018 commented Dec 1, 2018 via email

@jackwangottawa
Copy link

Actually there is an error msg when I called optimizor before I encounter the above issue
"ValueError: Variable d/h0/conv2d/W_conv3d/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?"

Shall I use GradientDescentOptimizer(). instead of Adam?

@jackwangottawa
Copy link

please ignore the past comments. I can run it now but there is no any output. Your code only can run on GPU?

@LoveSimons
Copy link

Thank you for your reply. I have solved the problem by adding a command as below :
with tf.variable_scope(tf.get_variable_scope())

Though i have trained the 3D GAN model successuflly, the chair i generated is wrong, it seems that i generate a cube. I have noticed that the generator contains four layers, h0(fc)-h1(deconv)-h2(deconv)-h3(deconv). I am confused if it is the full definition of the generator in this 3D GAN model or just part of it? Hope for your reply.

I have the same problem as you, where did you add "with tf.variable_scope(tf.get_variable_scope())"? Can you answer it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants