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

train-pqr.sh not working #9

Open
wdh91 opened this issue Dec 8, 2020 · 1 comment
Open

train-pqr.sh not working #9

wdh91 opened this issue Dec 8, 2020 · 1 comment

Comments

@wdh91
Copy link

wdh91 commented Dec 8, 2020

I set the code in 'train-sqr.sh' for my datasets:
"
##Set up the working environment.
CURRENT_DIR=$(pwd)
WORK_DIR="${CURRENT_DIR}/deeplab"
DATASET_DIR="datasets"

##Set up the working directories.
PQR_FOLDER="20201206_test"
EXP_FOLDER="exp/train_on_trainval_set"
INIT_FOLDER="${WORK_DIR}/${DATASET_DIR}/${PQR_FOLDER}/${EXP_FOLDER}/init_models"
TRAIN_LOGDIR="${WORK_DIR}/${DATASET_DIR}/${PQR_FOLDER}/${EXP_FOLDER}/train"
DATASET="${WORK_DIR}/${DATASET_DIR}/${PQR_FOLDER}/tfrecord"

mkdir -p "${WORK_DIR}/${DATASET_DIR}/${PQR_FOLDER}/exp"
mkdir -p "${TRAIN_LOGDIR}"

NUM_ITERATIONS=1000
python3 "${WORK_DIR}"/train.py
--logtostderr
--train_split="train"
--model_variant="xception_65"
--atrous_rates=6
--atrous_rates=12
--atrous_rates=18
--output_stride=16
--decoder_output_stride=4
--train_crop_size=165,164
--train_batch_size=4
--training_number_of_steps="${NUM_ITERATIONS}"
--fine_tune_batch_norm=true
--tf_initial_checkpoint="${INIT_FOLDER}/deeplabv3_pascal_train_aug/model.ckpt"
--train_logdir="${TRAIN_LOGDIR}"
--dataset_dir="${DATASET}"
"

I got an error as below:

Traceback (most recent call last):
File "/data/dywon/segmentation2/models/research/deeplab/train.py", line 513, in
tf.app.run()
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "/data/dywon/segmentation2/models/research/deeplab/train.py", line 463, in main
dataset.get_one_shot_iterator(), dataset.num_of_classes,
File "/data/dywon/segmentation2/models/research/deeplab/datasets/data_generator.py", line 347, in get_one_shot_iterator
.map(self._preprocess_image, num_parallel_calls=self.num_readers))
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 1913, in map
self, map_func, num_parallel_calls, preserve_cardinality=False))
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3472, in init
use_legacy_function=use_legacy_function)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 2713, in init
self._function = wrapper_fn._get_concrete_function_internal()
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1853, in _get_concrete_function_internal
*args, **kwargs)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1847, in _get_concrete_function_internal_garbage_collected
graph_function, _, _ = self._maybe_define_function(args, kwargs)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 2147, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 2038, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/func_graph.py", line 915, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 2707, in wrapper_fn
ret = _wrapper_helper(*args)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 2652, in _wrapper_helper
ret = autograph.tf_convert(func, ag_ctx)(*nested_args)
File "/data/dywon/anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in converted code:
relative to /data/dywon:
segmentation2/models/research/deeplab/datasets/data_generator.py:305 _preprocess_image *
original_image, image, label = input_preprocess.preprocess_image_and_label(
segmentation2/models/research/deeplab/input_preprocess.py:114 preprocess_image_and_label *
processed_image = preprocess_utils.pad_to_bounding_box(
segmentation2/models/research/deeplab/core/preprocess_utils.py:150 pad_to_bounding_box *
width_params = tf.stack([offset_width, after_padding_width])
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/util/dispatch.py:180 wrapper
return target(*args, **kwargs)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/ops/array_ops.py:1154 stack
return gen_array_ops.pack(values, axis=axis, name=name)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_array_ops.py:6303 pack
"Pack", values=values, axis=axis, name=name)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py:794 _apply_op_helper
op_def=op_def)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/func_graph.py:548 create_op
compute_device)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:3426 _create_op_internal
op_def=op_def)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1770 init
control_input_ops)
anaconda3/envs/frcnn2/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1610 _create_c_op
raise ValueError(str(e))

ValueError: Shapes must be equal rank, but are 0 and 1
    From merging shape 0 with other shapes. for 'pad_to_bounding_box/stack_4' (op: 'Pack') with input shapes: [], [3].

Anyone help me out?

@heaversm
Copy link
Owner

I vaguely remember that error being related to the dimensions of your training vs your processed images - they should be the same. Is that the case for you?

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

2 participants