Skip to content Skip to sidebar Skip to footer

Input Pipeline For Semantic Image Segmentation (3 Labels) With Keras (TensforFlow Backend) Using Flow_from_directory()

I am using keras (TensorFlow backend) and I am trying to understand how to bring in my labels/masks for image segmentation (3 labels) using flow_from_directory. The train_images ha

Solution 1:

Currently working on something very similar but with 10 classes. Still not entirely there yet, but as to you question about built-in functions for keras, checkout:

one_hot_array = keras.utils.to_categorical(array_of_label_data, nb_classes)

which creates a one-hot-vector of your mask/label data. So for your case, the expect output for say 100 masks would be (100, H, W, 3), where 3 is equal to the number of classes you're working with. What I'm not sure about is if you do or do not have a background in your mask, and also, how you're supposed to structure the folders for your data. Hope that helps though.

Also, your target_size is off, that's referring to the dimensions of your images (e.g. height and width). There shouldn't be a third value.


Post a Comment for "Input Pipeline For Semantic Image Segmentation (3 Labels) With Keras (TensforFlow Backend) Using Flow_from_directory()"