Open kaulanishasj opened 7 years ago
Three changes should be made
ex: in line 216, you should use: upsample4 = deconv_layer(pool4, [2, 2, 64, 64], [batch_size, 8, 8, 64], 2, "up4")
I should make this more easier by making this model as a class and take a config file as initialization
Hi,
Training with 480x360 works as expected.
I'm trying with a resized version of the CamVid dataset where images are 512x384. Everything else is the same as regular CamVid dataset. I've changed global variables and upsample layer shapes accordingly ( 64x48 -> 128x96 -> 256x192 -> 512x384 ).
When I try to train, I get OutOfRangeError caused by shuffle_batch. Any idea why this happens? OutOfRangeError (see above for traceback): RandomShuffleQueue '_1_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 2, current size 0) [[Node: shuffle_batch = QueueDequeueManyV2[component_types=[DT_FLOAT, DT_UINT8], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
Hi, Usually this is caused by empt queue(wrong data path). Have you checked the datatset path? which located in SegNet-Tutorial/CamVId/train.txt and SegNet-Tutorial/CamVid/val.txt. If you downloaded the data through original author's git, you need to change the path prefix to fit in your own environment.
Hi @tkuanlun350, thank you very much for your code. As many other said, your codes are running perfectly for CamVid dataset.
I will extend it by using Cityscapes dataset, so I am trying to make some adjustments. However, I still cannot set up the program since CamVid and Cityscapes are so different. Cityscapes dataset has 19 object classes, 1975 train images, and 500 val images. The image size is 1024x2048.
There is an error message: ValueError: Dimensions must be equal, but are 19 and 11 for 'loss/Mul' (op: 'Mul') with input shapes: [10485760,19], [11].
So, would you like to tell us how to deal with it, please?
Thank you very much. Mahmud
@tkuanlun350 thanks for the code , i am trying to run it for my custom dataset . the size of the image is 300*300 i have made the changes which you suggested earlier
Thanking you in advance
He means, in the models file, when you define inference, you need to change the image sizes when you upsample. I'm not sure about this, but it's possible you need to change the size of your images because 300 is not divisible by 8. The code below references muralabmahmuds's answer in another thread. #change is where you would edit the values of the image size. I put in your values, but I don't think 62.5 would be possible in upsample4.
# upsample4
# Need to change when using different dataset out_w, out_h
# upsample4 = upsample_with_pool_indices(pool4, pool4_indices, pool4.get_shape(), out_w=45, out_h=60, scale=2, name='upsample4')
upsample4 = deconv_layer(pool4, [2, 2, 64, 64], [batch_size, 62.5, 62.5, 64], 2, "up4") #change
# decode 4
conv_decode4 = conv_layer_with_bn(upsample4, [7, 7, 64, 64], phase_train, False, name="conv_decode4")
# upsample 3
# upsample3 = upsample_with_pool_indices(conv_decode4, pool3_indices, conv_decode4.get_shape(), scale=2, name='upsample3')
upsample3= deconv_layer(conv_decode4, [2, 2, 64, 64], [batch_size, 125, 125, 64], 2, "up3") #change
# decode 3
conv_decode3 = conv_layer_with_bn(upsample3, [7, 7, 64, 64], phase_train, False, name="conv_decode3")
# upsample2
# upsample2 = upsample_with_pool_indices(conv_decode3, pool2_indices, conv_decode3.get_shape(), scale=2, name='upsample2')
upsample2= deconv_layer(conv_decode3, [2, 2, 64, 64], [batch_size, 150, 150, 64], 2, "up2") #change
# decode 2
conv_decode2 = conv_layer_with_bn(upsample2, [7, 7, 64, 64], phase_train, False, name="conv_decode2")
# upsample1
# upsample1 = upsample_with_pool_indices(conv_decode2, pool1_indices, conv_decode2.get_shape(), scale=2, name='upsample1')
upsample1= deconv_layer(conv_decode2, [2, 2, 64, 64], [batch_size, 300, 300, 64], 2, "up1") #change
# decode4
conv_decode1 = conv_layer_with_bn(upsample1, [7, 7, 64, 64], phase_train, False, name="conv_decode1")
""" end of Decode """
@tom-hao thanks for the input i have rescaled the images and now its working perfectly !!
Hi Tseng,
I have my own set of data in similar directory structure that your code accepts. But I have two big changes, 1) each image and the corresponding label image is 64*64 2) The number of classes are only 2 now
How do you suggest I go by to make Segnet work to accomodate these changes?
Thanks Anisha