hellochick / ICNet-tensorflow

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

Train with different NUM_CLASSES #20

Open An-Pan opened 6 years ago

An-Pan commented 6 years ago

Hi , I want train ICNet with different NUM_CLASSES (eg NUM_CLASSES = 12).So I changed all the num_classes=19 to 12 in .py and num_output in .prototxt. But when I run python train.pyI get error: Dimension 3 in both shapes must be equal, but are 17 and 19. Shapes are [1,1,128,12] and [1,1,128,19]. for 'conv6_cls_1/Assign' So , can you give me some advice on how to traing ICNet with different class num? And can I use icnet_cityscapes_trainval_90k.npy as pretrained model on this situation?

hellochick commented 6 years ago

You can use the pre-trained model by selecting restore variables. Following is the example:

restore_var = [v for v in tf.global_variables() if 'conv6_cls' not in v.name
An-Pan commented 6 years ago

@hellochick Thanks ,Now I have resolve the pre-trained model problem.

ifangcheng commented 6 years ago

when I set num_classes=1 (255 for background; 0 for person), and train on my own dataset, I always got sub4 =0.000 sub24 =0.000 sub124 =0.000 ans the total loss do not change at all. what's the problem? did I miss something?