Hi,
I change the example to use my dataset.
I have just one class (the mask has two colors, black and with).
The image has 140x140 pixels.
n_classes = 1
dataset_path = 'seg'
loader = Loader.Loader(dataFolderPath=dataset_path, n_classes=n_classes, problemType='segmentation', width=140,
height=140, ignore_label=n_classes)
model = MnasnetEager.MnasnetFC(num_classes=n_classes)
optimizer = tf.train.AdamOptimizer(0.001)
train(loader=loader, model=model, epochs=20, batch_size=8)
get_params(model)
The result generates an error:
Using TensorFlow backend.
Reading files...
Structuring test and train files...
Loaded 92 training samples
Loaded 10 testing samples
Dataset contains 1 classes
epoch: 0
Traceback (most recent call last):
File "train_eager_seg.py", line 109, in
train(loader=loader, model=model, epochs=20, batch_size=1)
File "train_eager_seg.py", line 44, in train
x, y, mask = loader.get_batch(size=batch_size, train=True, augmenter=augmenter)
File "/pylon5/ac3uump/rafaelmr/Semantic-Segmentation-Tensorflow-Eager/Loader.py", line 377, in get_batch
return self._get_batch_segmentation(size=size, train=train, augmenter=augmenter)
File "/pylon5/ac3uump/rafaelmr/Semantic-Segmentation-Tensorflow-Eager/Loader.py", line 296, in _get_batch_segmentation
y = to_categorical(y, num_classes=self.n_classes+1)
File "/home/rafaelmr/.conda/envs/seg1/lib/python2.7/site-packages/keras/utils/np_utils.py", line 32, in to_categorical
categorical[np.arange(n), y] = 1
IndexError: index 255 is out of bounds for axis 1 with size 2
Probably the error is associated with the number of the classes.
I put the correct number of the classes. I try others numbers, but the problem still the same.
Do I need to code another place?