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

img_size is ignored when testing #20

Closed
cpury opened this issue Aug 6, 2019 · 2 comments
Closed

img_size is ignored when testing #20

cpury opened this issue Aug 6, 2019 · 2 comments

Comments

@cpury
Copy link

cpury commented Aug 6, 2019

I wanted to train a test model via:

python main.py --dataset mydata --light=True --iteration=5000 --img_size=100 --save_freq=20

That seems to work fine. However, when running the test command, I get:

Traceback (most recent call last):
  File "main.py", line 106, in <module>
    main()
  File "main.py", line 102, in main
    gan.test()
  File "/content/UGATIT/UGATIT.py", line 640, in test
    fake_img = self.sess.run(self.test_fake_B, feed_dict = {self.test_domain_A : sample_image})
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1149, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 256, 256, 3) for Tensor 'test_domain_A:0', which has shape '(1, 100, 100, 3)'

Seems to me the model has the right size, but the loaded data in test mode defaults to 256?

@cpury cpury changed the title img_size is ignored when testing? img_size is ignored when testing Aug 6, 2019
@sam598
Copy link

sam598 commented Aug 9, 2019

On lines 647 and 663 of UGATIT.py change:
sample_image = np.asarray(load_test_data(sample_file))
to:
sample_image = np.asarray(load_test_data(sample_file, size=self.img_size))

@cpury
Copy link
Author

cpury commented Aug 9, 2019

Awesome! If you're running this in the cloud and are too lazy to fork the project like me, this will fix it:

sed -i 's/load_test_data(sample_file)/load_test_data(sample_file, size=self.img_size)/g' UGATIT/UGATIT.py

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