Transfer Learning For Semantic Segmentation

Hi everyone.

Just getting started with Conv Nets and trying out an image segmentation problem. I got my hands on 24 images and their masks for the dstl satellite image feature detection competition. I thought I’d try to follow the tips here https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html but I’m stuck.

I downloaded the pre-trained weights for ZF_UNET_224, the 2nd place winners’ approach to this problem. My image masks contain 5 objects so I popped the final layer and instead of having this:

activation_45 (Activation) (None, 224, 224, 32) 0 batch_normalization_44[0][0]


spatial_dropout2d_2 (SpatialDro (None, 224, 224, 32) 0 activation_45[0][0]


conv2d_46 (Conv2D) (None, 224, 224, 1) 33 spatial_dropout2d_2[0][0]


I have this now:

activation_45 (Activation) (None, 224, 224, 32) 0 batch_normalization_44[0][0]


spatial_dropout2d_2 (SpatialDro (None, 224, 224, 32) 0 activation_45[0][0]


predictions (Conv2D) (None, 224, 224, 5) 10 conv2d_46[0][0]

I’m trying to follow the exact steps from the Keras tutorial but when I do

my_model.fit_generator(
train_generator,
steps_per_epoch= 4,
epochs=10,
validation_data=validation_generator )

I get an error message saying

Output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: [[[[1. 1. 1. ]
[1. 1. 1. ]
[1. 1. 1. ]

[1. 1. 1. ]
[1. 1. 1. ]
[1. 1. 1. ]]

I think what I want is probabilities for each of the pixels in my 224X224 image, so that I can use those to generate masks on the original image but I’m not sure how to go about getting that. Any help?