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

compress single image with error #16

Open
zhiqiang-zhu opened this issue Jul 4, 2018 · 3 comments
Open

compress single image with error #16

zhiqiang-zhu opened this issue Jul 4, 2018 · 3 comments

Comments

@zhiqiang-zhu
Copy link

zhiqiang-zhu commented Jul 4, 2018

Traceback (most recent call last):
File "compress.py", line 80, in
main()
File "compress.py", line 77, in main
single_compress(config_test, args)
File "compress.py", line 60, in single_compress
Utils.single_plot(0, 0, sess, gan, handle, save_path, config, single_compress=True)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/utils.py", line 107, in single_plot
r, g = sess.run([real, gen], feed_dict={model.training_phase:True, model.handle: handle})
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected image (JPEG, PNG, or GIF), got unknown format starting with 'BM\212\000\014\000\000\000\000\000\212\000\000\000|\000'
[[Node: DecodePng = DecodePngchannels=3, dtype=DT_UINT8]]
[[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,?,?,3]], output_types=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
[[Node: generator/decoder/conv2d_transpose_3/conv2d_transpose-0-VecPermuteNHWCToNCHW-LayoutOptimizer/_395 = _HostRecvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1470_...tOptimizer", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

The compressed image format is bmp, and then occurre an error.

@Justin-Tan
Copy link
Owner

You should have the input image as a JPEG or PNG instead of BMP or GIF.

@zhiqiang-zhu
Copy link
Author

thank you for your reply, but there is an error when I train the model on ADE20k dataset:
Traceback (most recent call last):
File "train.py", line 128, in
main()
File "train.py", line 125, in main
train(config_train, args)
File "train.py", line 35, in train
gan = Model(config, paths, name=args.name, dataset=args.dataset)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/model.py", line 78, in init
self.z = tf.concat([self.w_hat, Gv], axis=-1, name="ZZQ")
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1189, in concat
return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 953, in concat_v2
"ConcatV2", values=values, axis=axis, name=name)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1734, in init
control_input_ops)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension 2 in both shapes must be equal, but are 32 and 64. Shapes are [?,?,32] and [?,32,64]. for 'generator/ZZQ' (op: 'ConcatV2') with input shapes: [?,?,32,8], [?,32,64,8], [] and with computed input tensors: input[2] = <-1>.

I have change the input image's width to 512px, I checked the code, the shape of w_hat and Gv is not same when sampling noise in model.py, can you give me some advices? Thanks!

@lzhzju
Copy link

lzhzju commented Aug 24, 2022

thank you for your reply, but there is an error when I train the model on ADE20k dataset: Traceback (most recent call last): File "train.py", line 128, in main() File "train.py", line 125, in main train(config_train, args) File "train.py", line 35, in train gan = Model(config, paths, name=args.name, dataset=args.dataset) File "/home/zqzhu/EX/GAN_CC/generative-compression-master/model.py", line 78, in init self.z = tf.concat([self.w_hat, Gv], axis=-1, name="ZZQ") File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1189, in concat return gen_array_ops.concat_v2(values=values, axis=axis, name=name) File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 953, in concat_v2 "ConcatV2", values=values, axis=axis, name=name) File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op op_def=op_def) File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1734, in init control_input_ops) File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op raise ValueError(str(e)) ValueError: Dimension 2 in both shapes must be equal, but are 32 and 64. Shapes are [?,?,32] and [?,32,64]. for 'generator/ZZQ' (op: 'ConcatV2') with input shapes: [?,?,32,8], [?,32,64,8], [] and with computed input tensors: input[2] = <-1>.

I have change the input image's width to 512px, I checked the code, the shape of w_hat and Gv is not same when sampling noise in model.py, can you give me some advices? Thanks!

I have the same problem, have you solved 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

3 participants