hellochick / ICNet-tensorflow

TensorFlow-based implementation of "ICNet for Real-Time Semantic Segmentation on High-Resolution Images".
406 stars 153 forks source link

Assign requires shapes of both tensors to match. lhs shape= [13] rhs shape= [150] #128

Open shakey-cuimiao opened 4 years ago

shakey-cuimiao commented 4 years ago

I have change restore_var = tf.global_variables() to restore_var = [v for v in tf.global_variables() if 'conv6_cls' not in v.name] Update INPUT_SIZE to '512, 512' Update NUM_CLASSES to 13 filter_scale=2. model_type = 'others' when run python train.py --dataset others ,I get erros: raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [13] rhs shape= [150] [[node save/Assign_382 (defined at /home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py:79) ]]

Errors may have originated from an input operation. Input Source operations connected to node save/Assign_382: sub24_out/biases (defined at /home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py:145)

Original stack trace for 'save/Assign_382': File "train.py", line 167, in main() File "train.py", line 146, in main train_net.restore(cfg.model_weight, restore_var) File "/home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py", line 79, in restore loader = tf.train.Saver(var_list=tf.global_variables()) File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 825, in init self.build() File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 837, in build self._build(self._filename, build_save=True, build_restore=True) File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 875, in _build build_restore=build_restore) File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 508, in _build_internal restore_sequentially, reshape) File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 350, in _AddRestoreOps assign_ops.append(saveable.restore(saveable_ten