logo
Loading...

ImageDataGenerator範例問題 - Cupoy

所給的範例中, 這個應該是無法執行的吧~~?!!就這樣給一個無法執行的範例, 要學員們進行學習, 我...

cvdl-2

ImageDataGenerator範例問題

2020/03/13 02:04 PM
電腦視覺深度學習論壇
陽明益
觀看數:0
回答數:3
收藏數:4
cvdl-2

所給的範例中, 這個應該是無法執行的吧~~?!!

就這樣給一個無法執行的範例, 要學員們進行學習, 我覺得教學太跳了

沒有學過的學員, 應該無法吸收的, 應該要檢討一下了~~


#Training Generator

train_datagen = ImageDataGenerator(rescale = 2,shear_range = 0.2,zoom_range = 0.2,horizontal_flip = True)

#Test Generator,只需要Rescale,不需要其他增強

test_datagen = ImageDataGenerator(rescale = 1./255)


#將路徑給Generator,自動產生Label

training_set = train_datagen.flow_from_directory('dataset/training_set',

                                                target_size = (64, 64),

                                                batch_size = 32,

                                                class_mode = 'categorical')


test_set = test_datagen.flow_from_directory('dataset/test_set',

                                           target_size = (64, 64),

                                           batch_size = 32,

                                           class_mode = 'categorical')


#訓練

classifier.fit_generator(training_set,steps_per_epoch = 250,nb_epoch = 25,

                        validation_data = valid_set,validation_steps = 63)