Closed shbnm21 closed 4 years ago
@shbnm21 I remember you have solved this issue before? #23
Yes I solved it when I was training it
But in testing it's not working.
I had used dataset folder where I kept data folder
And that solved my problem but same thing not working with testing.
@shbnm21 I am sorry for the late response. Did you solve the problem? I cannot find out the problem from your information, did you totally follow the instruction in README? And one thing to be checked: Keep all the data including training set and testing set.
No ,I have not solved it.
I tried previous solution but its not working.Problem is in data.py
Traceback (most recent call last):
File "data.py", line 260, in
data.py:59 map_func_ *
return map_func(*parse_func(*args))
data.py:52 parse_func *
img = tf.io.read_file(path)
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_io_ops.py:626 read_file
"ReadFile", filename=filename, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py:551 _apply_op_helper
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.
Problem is in the datapath
I am not understanding what am i doing wrong
On google colab I am giving following path '/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/dataset/data'
i also changed it to '/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data'
then also getting same error
@shbnm21 I cannot figure out your problem, have you totally followed the README.md, or you have made some modification?
Yes I followed readme. I have a question. Do I need to use all the images Cz for testing I have uploaded only 637 images and according to it used attribute file.
I will test the code on Windows ,anaconda and then let u know.
@shbnm21 You can upload all data for safety. Besides, what do you mean below?
I am giving following path
'/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/dataset/data'
i also changed it to
'/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data'
then also getting same error
There shouldn't be any parameters for the data path. We should follow the below instruction,
Intially I put images into data folder as u mentioned in readme.
But then also I was getting that error
So I created dataset folder in that I created data folder and then kept the images (it's same ) But I was getting same error.
hello, i successfully tested the project,the error was coming because i was not using all the images.when i used all the images it ran successfully.
I have one more question how to check input and ouput nodes on tensorboard
Another question is do u have any idea how to convert checkpoint file to protobuf file(.pb file) I tried to convert STGAN model to .pb but getting parseerror
where to check generated images after testing?
@shbnm21 for .pb file, use API below,
from tensorflow.python.framework import graph_util
with tf.gfile.GFile(py.join(output_dir, 'generator.pb'), 'wb') as f:
constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['name_of_output_node'])
f.write(constant_graph.SerializeToString())
The generated images are in the output folder.
Thank u for the quick reply,and how to get output node name
@shbnm21 you can print the name of a tensor.
Ok thank u
I used following code to print tensor names from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file ckpt_path="/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/output/128_shortcut1_inject1none/checkpoints/Epoch(199)_(947of947).ckpt" print_tensors_in_checkpoint_file(file_name=ckpt_path, tensor_name='',all_tensors=True, all_tensor_names=True)
It has given all the tensor names along with their values for generator and descriminator
there is long list
here are few tensor_name: D/Conv/InstanceNorm/beta tensor_name: D/Conv/InstanceNorm/beta/Adam_1 tensor_name: D/Conv/weights tensor_name: D/Conv/weights/Adam_1 tensor_name: Gdec/Conv2d_transpose/BatchNorm/beta tensor_name: Gdec/Conv2d_transpose/BatchNorm/beta/Adam tensor_name: Gdec/Conv2d_transpose/BatchNorm/beta/Adam_1 tensor_name: Gdec/Conv2d_transpose/BatchNorm/gamma tensor_name: Gdec/Conv2d_transpose/BatchNorm/gamma/Adam tensor_name: Gdec/Conv2d_transpose/BatchNorm/gamma/Adam_1
which one to use?
You should choose the tensor you want then print the name of that tensor.
Can u please provide any script to print output node name. I didn't find any .
All I find needs .pb file or .pbtxt file
According to my understanding of Gan model,I need to find output layer of discriminator for output node. But I have a question In gan model both generator and discriminators are trained
So don't we need output nodes of both generator and discriminator
@shbnm21 For example,
If you want to output x_sample
in your .pb model, print its name by x_sample.name
.
Or you can use x_sample_rename = tf.identity(x_sample, name='new_name')
to rename it.
Thanks a ton.
Hello I have a question.this project tests images from 182637 to onwards.
If I want to test any random image .
For example if I want to test image 097000 and 098000 or any image from the data Then what changes I need to make in the code.
hello I have downloaded trained model and trying to test it but i am getting following error. can u please suggest what went wrong?
I am testing it on google colab and using only 182000 to 182637 images. TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.