qubvel / segmentation_models

Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
MIT License
4.74k stars 1.03k forks source link

Bug in multiclass segmentation (camvid).ipynb #332

Open SlinkoIgor opened 4 years ago

SlinkoIgor commented 4 years ago

It seems like dataset is not shuffled on epoch end: self.indexes is not used in getitem method

JordanMakesMaps commented 4 years ago

I think this would solve the problem, no?


def __getitem__(self, i):

        # collect batch data
        start = i * self.batch_size
        stop = (i + 1) * self.batch_size
        data = []
        for j in range(start, stop):
            data.append(self.dataset[self.indexes[j]]) # <------

        # transpose list of lists
        batch = [np.stack(samples, axis=0) for samples in zip(*data)]

        return batch