skyflynil / stylegan2

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

I don't know how to solve the shape error? #26

Closed C-hongfei closed 1 year ago

C-hongfei commented 3 years ago

My image is 1024 * 1024, and my parameters are !python run_training.py --num-gpus=1 --data-dir=../stylegan2/dataset --config=config-f --dataset=rice0 --mirror-augment=true --metric=none --total-kimg=40000 --min-h=8 --min-w=8 --res-log2=7

error: 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/_4567]] 0 successful operations. 0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run_training.py", line 218, in main() File "run_training.py", line 213, in main run(vars(args)) File "run_training.py", line 136, in run dnnlib.submit_run(kwargs) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/submit.py", line 343, in submit_run return farm.submit(submit_config, host_run_dir) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/internal/local.py", line 22, in submit return run_wrapper(submit_config) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/submit.py", line 280, in run_wrapper run_func_obj(*submit_config.run_func_kwargs) File "/content/drive/My Drive/Colab Notebooks/stylegan2/training/training_loop.py", line 318, in training_loop tflib.run(data_fetch_op, feed_dict_d) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/tflib/tfutil.py", line 31, in run return tf.get_default_session().run(args, **kwargs) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 956, in run run_metadata_ptr) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1359, in _do_run run_metadata) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/client/session.py", line 1384, in _do_call raise type(e)(node_def, op, message) 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 (defined at /tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py:1748) ]] (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 (defined at /tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py:1748) ]] [[GPU0/DataFetch/IteratorGetNext/_4567]] 0 successful operations. 0 derived errors ignored.

Original stack trace for 'GPU0/DataFetch/IteratorGetNext': File "run_training.py", line 218, in main() File "run_training.py", line 213, in main run(vars(args)) File "run_training.py", line 136, in run dnnlib.submit_run(kwargs) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/submit.py", line 343, in submit_run return farm.submit(submit_config, host_run_dir) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/internal/local.py", line 22, in submit return run_wrapper(submit_config) File "/content/drive/My Drive/Colab Notebooks/stylegan2/dnnlib/submission/submit.py", line 280, in run_wrapper run_func_obj(*submit_config.run_func_kwargs) File "/content/drive/My Drive/Colab Notebooks/stylegan2/training/training_loop.py", line 216, in training_loop reals_write, labels_write = training_set.get_minibatch_tf() File "/content/drive/My Drive/Colab Notebooks/stylegan2/training/dataset.py", line 198, in get_minibatch_tf return self._tf_iterator.get_next() File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/data/ops/iterator_ops.py", line 426, in get_next name=name) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/ops/gen_dataset_ops.py", line 2518, in iterator_get_next output_shapes=output_shapes, name=name) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/util/deprecation.py", line 507, in new_func return func(args, **kwargs) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py", line 3357, in create_op attrs, op_def, compute_device) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal op_def=op_def) File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

JellyDream commented 3 years ago

change it to ndims

JellyDream commented 1 year ago

已收到!