stylegan2 icon indicating copy to clipboard operation
stylegan2 copied to clipboard

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

Open MATTJ0NES opened this issue 4 years ago • 7 comments

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

MATTJ0NES avatar Oct 13 '20 12:10 MATTJ0NES

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

monolesan avatar Dec 11 '20 04:12 monolesan

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

MATTJ0NES avatar Dec 11 '20 10:12 MATTJ0NES

Thank you SO MUCH! It works! c:

monolesan avatar Dec 12 '20 09:12 monolesan

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

molo32 avatar Dec 17 '20 04:12 molo32

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.”

monolesan avatar Dec 17 '20 05:12 monolesan

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 avatar Dec 23 '20 13:12 C-hongfei

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

C-hongfei avatar Dec 23 '20 13:12 C-hongfei