از data generator استفاده کردم ولی داده های من عکسن و نمیدونم چطوری توی بخش dataset باید واردشون کنم!(اون چیزایی ک نوشتم حالتیه که توی خود سایت کراس توضیح داده ولی من متوجه نشدم).ممنون میشم راهنمایی بفرمایین
import numpy as np
from keras.models import Sequential
from myClasses import DataGenerator
# Parameters
params = {'dim': (32,32,32),
'batch_size': 64,
'n_classes': 6,
'n_channels': 1,
'shuffle': True}
# Datasets
partition = {'train': ['id-1', 'id-2', 'id-3'], 'validation': ['id-4']}
labels = {'id-1': 0, 'id-2': 1, 'id-3': 2, 'id-4': 1}
# Generators
training_generator = DataGenerator(partition['train'], labels, **params)
validation_generator = DataGenerator(partition['validation'], labels, **params)
# Design model
#create layers and model
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D
from keras.models import Model
import numpy as np
from keras import backend as K
input_img = Input(shape=[228, 228, 1]) # adapt this if using `channels_first` image data format
x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_img)
x = MaxPooling2D((2, 2), padding='same')(x)
x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D((2, 2), padding='same')(x)
x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
encoded = MaxPooling2D((2, 2), padding='same')(x)
# at this point the representation is (4, 4, 8) i.e. 128-dimensional
x = Conv2D(8, (3, 3), activation='relu', padding='same')(encoded)
x = UpSampling2D((2, 2))(x)
x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
x = UpSampling2D((2, 2))(x)
x = Conv2D(16, (3, 3), activation='relu')(x)
x = UpSampling2D((2, 2))(x)
decoded = Conv2D(1, (3, 3), activation='sigmoid', padding='same')(x)
autoencoder = Model(input_img, decoded)
autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')
#=====================================
# Train model on dataset
autoencoder.fit_generator(generator=training_generator, validation_data=validation_generator,use_multiprocessing=True ,workers=6)
اروری که موقع ران این کد میگیرم بصورت زیر هست که فک کنم بخاطر ورودی دادن اشتباهه:
Using TensorFlow backend.
Epoch 1/1
Traceback (most recent call last):
File "C:/Users/afghahi/PycharmProjects/ImageProcessing/kerasScript.py", line 55, in <module>
autoencoder.fit_generator(generator=training_generator, validation_data=validation_generator,use_multiprocessing=True ,workers=6)
File "E:\Program Files\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "E:\Program Files\Python\Python36\lib\site-packages\keras\engine\training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "E:\Program Files\Python\Python36\lib\site-packages\keras\engine\training_generator.py", line 251, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "E:\Program Files\Python\Python36\lib\site-packages\keras\callbacks.py", line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "E:\Program Files\Python\Python36\lib\site-packages\keras\callbacks.py", line 338, in on_epoch_end
self.progbar.update(self.seen, self.log_values)
AttributeError: 'ProgbarLogger' object has no attribute 'log_values'
Process finished with exit code 1