Open sunwoo76 opened 4 years ago
I solve this problem. I think that 'segmentation_models' is implemented using 'keras' not 'tf.keras'.
Error version(for using segmentation models)
import tensorflow
Class Datagenerator('tf.keras.utils.Sequence')
Revised Version import keras class Datagenerator('keras.utils.Sequence')
and it worked. I hope you guys get help. thanks
can you tell me the exact versions of Keras, Keras-Applications, Keras-Preprocessing and Tensorflow that you used to make this work?
I got same issue
Dataset.py
`` import os #for accessing the file system of the system import random from skimage import io from skimage.transform import resize import numpy as np import tensorflow as tf from tensorflow import keras
seed = 2323 #seed values to create random values random.seed = seed np.random.seed = seed tf.seed = seed
class DataGenerator(keras.utils.Sequence): def init(self, ids, imgs_dir, masks_dir, batch_size=10, img_size=128, n_classes=1, n_channels=3, shuffle=True): self.id_names = ids self.indexes = np.arange(len(self.id_names)) self.imgs_dir = imgs_dir self.masks_dir = masks_dir self.batch_size = batch_size self.img_size = img_size self.n_classes = n_classes self.n_channels = n_channels self.shuffle = shuffle self.on_epoch_end()
``
train.py
`` import os # for accessing the file system of the system import segmentation_models as sm from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPlateau from dataset import DataGenerator import tensorflow.keras as keras
if name == 'main':
hyperparameter
``
----> 2 model.fit_generator(generator=train_gen, validation_data=valid_gen, steps_per_epoch=train_steps, validation_steps=valid_steps, epochs=50) ValueError:
validation_data
should be a tuple(val_x, val_y, val_sample_weight)
or(val_x, val_y)
.Could you tell me why does this error occur?