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

The encoded image can only be 400*400? #43

Open
zhouzhiyang-666 opened this issue Jan 12, 2022 · 4 comments
Open

The encoded image can only be 400*400? #43

zhouzhiyang-666 opened this issue Jan 12, 2022 · 4 comments

Comments

@zhouzhiyang-666
Copy link

zhouzhiyang-666 commented Jan 12, 2022

ValueError: Cannot feed value of shape (1, 200, 200, 3) for Tensor 'input_hide:0', which has shape '(?, 400, 400, 3)'
How to achieve the encoded image pixels and the encoded pixels consistent?

@zhouzhiyang-666 zhouzhiyang-666 changed the title 编码后的图片只能是400*400吗 The encoded image can only be 400*400? Jan 12, 2022
@ghost
Copy link

ghost commented Jan 13, 2022

The size of input picture of pretrained model provided by author is 400 * 400 pixels, so if you don't modify the network structure and train separately for your picture size, just want to use the pretrained model, you need to modify your picture size. tf.image.resize_image_with_crop_or_pad or other image processing functions could be useful to resize the image

@zhouzhiyang-666
Copy link
Author

I want to make the encoded image the same as the pixels before encoding.
I changed encode_image.py separately. width and height modify to 500.
It throws the following question.
Traceback (most recent call last):
File "encode_image.py", line 94, in
main()
File "encode_image.py", line 75, in main
hidden_img, residual = sess.run([output_stegastamp, output_residual],feed_dict=feed_dict)
File "/home/abc/venvs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/abc/venvs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 500, 500, 3) for Tensor 'input_hide:0', which has shape '(?, 400, 400, 3)'

@ghost
Copy link

ghost commented Jan 13, 2022

Only the changes of encode_image.py can't work. The structure of the pre-trained model provided by the author determines that your input CAN ONLY BE the size of 400 * 400. If you want the size of input and output to be 500*500, you need to re-train a model, which requires changing the code in models.py and train.py.

A simpler method is that you can write a function to resize picture to 400 * 400 before it is input into the model, and again resize it to 500 * 500 after output. However, since the author did not add the process of it to the analog noise, which includes the process of interpolation and down sampling. I guess the decoding accuracy after scaling will be impacted more or less.

@zhouzhiyang-666
Copy link
Author

Thank you for your reply! Now I am trying to do Images for lossless zoom.

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

1 participant