hellochick / ICNet-tensorflow

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

ValueError when using own dataset #116

Open SpencerTrihus opened 4 years ago

SpencerTrihus commented 4 years ago

Hi,

I am trying to train ICNet on my own dataset using the cityscapes model as a starting point, but when I run train.py I receive the error:

ValueError: Dimension 3 in both shapes must be equal, but are 64 and 32. Shapes are [3,3,3,64] and [3,3,3,32]. for 'conv1_1_3x3_s2_2/Assign' (op: 'Assign') with input shapes: [3,3,3,64], [3,3,3,32].

My dataset only has 1 object (2 if background included). This seems similar to issue #20 and #50, but I am not familiar with how to change the number of classes so that there is no discrepancy. I have updated config.py to indicate 2 object classes, but it seems there are other files that must be modified.

Thanks for your help!

SpencerTrihus commented 4 years ago

UPDATE:

I have resolved the above issue occuring in conv1 by changing the input image size of my dataset in utils/config.py.

Now I receive the issue described in #50 as the following:

ValueError: Dimension 3 in both shapes must be equal, but are 2 and 19. Shapes are [1,1,128,2] and [1,1,128,19]. for 'conv6_cls_2/Assign' (op: 'Assign') with input shapes: [1,1,128,2], [1,1,128,19].

Could you explain how to resolve this issue? I have changed config.py so that it indicates there are 2 classes, and I have replaced

restore_var = tf.global_variables()

with

restore_var = [v for v in tf.global_variables() if 'conv6_cls' not in v.name.

What else do I need to do to fix this problem?

Thanks!

songshan0321 commented 4 years ago

Facing the same issue after doing the same thing as you, did u solve this?? Thanks