skyflynil / stylegan2

StyleGAN2 - Official TensorFlow Implementation with practical improvements
http://arxiv.org/abs/1912.04958
Other
120 stars 33 forks source link

ValueError: Dimension 2 in both shapes must be equal, but are 1024 and 1280. #23

Open MATTJ0NES opened 3 years ago

MATTJ0NES commented 3 years ago

Hi,

I get this message when I try to run training on my custom dataset.

ValueError: Dimension 2 in both shapes must be equal, but are 1024 and 1280.

I know all my images are 1024x1024 but the error message seems to suggest otherwise. And the same images work fine on the original stylegan2, so not sure where this is going wrong.

Thanks

monolesan commented 3 years ago

Have you solved this problem? I just get the same error.

MATTJ0NES commented 3 years ago

In the end this worked in Colab for me on 1024x1024 so I guess connected to the min-h and min-w needing to correspond to your images. Hope this helps.

!python run_training.py --num-gpus=1 --data-dir=/yourdatadir --config=config-e --dataset=yourdataset --min-h=8 --min-w=8 --res-log2=7 --mirror-augment=true --metric=none --total-kimg=20000 --result-dir=./results

monolesan commented 3 years ago

Thank you SO MUCH! It works! c:

molo32 commented 3 years ago

I am learning stylegan. How do you know that 1024x1024 is --min-h = 8 --min-w = 8 --res- log2 = 7? how is this calculated?

monolesan commented 3 years ago

The formula is given in description of this repository: “Create training image set. Instead of image size of 2^n 2^n, now you can process your image size as of (min_h x 2^n) X (min_w 2^n) natually. For example, 640x384, min_h = 5, min_w =3, n=7. Please make sure all your raw images are preprocessed to the exact same size. To reduce the training set size, JPEG format is preferred.”

C-hongfei commented 3 years ago

Maybe I have the same problem as you? Can you give me some advice?

Traceback (most recent call last): File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Cannot batch tensors with different shapes in component 0. First element had shape [3,1024,1024] and element 1 had shape [3,3840,2699]. [[{{node GPU0/DataFetch/IteratorGetNext}}]] (1) Invalid argument: Cannot batch tensors with different shapes in component 0. First element had shape [3,1024,1024] and element 1 had shape [3,3840,2699]. [[{{node GPU0/DataFetch/IteratorGetNext}}]] [[GPU0/DataFetch/IteratorGetNext/_5073]] 0 successful operations. 0 derived errors ignored.

C-hongfei commented 3 years ago

I don't know why [3,3840,2699]. this shape appears