neural network - How to fit data from InceptionV3 to ImageDataGenerator -
how fit data inceptionv3 imagedatagenerator?
the examples found fitting data imagedatagenerator mnist or cifar10, this:
(x_train, y_train), (x_test, y_test) = mnist.load_data() # fit parameters data datagen.fit(x_train)
but can fit data inceptionv3 model imagedatagenerator?
i load inception v3 model like:
base_model = inceptionv3(weights='imagenet', include_top=true) datagen = imagedatagenerator(...) datagen.fit(base_model.get_layer('avg_pool').output)
but error saying 'valueerror: setting array element sequence.'
i assume need in 2 steps. first feed in data inceptionv3 model , saving output numpy array. feeding numpy array second model.
first step (taken here):
generator = datagen.flow_from_directory( 'data/train', target_size=(150, 150), batch_size=batch_size, class_mode=none, # means our generator yield batches of data, no labels shuffle=false) # our data in order bottleneck_features_train = model.predict_generator(generator, 2000) np.save(open('bottleneck_features_train.npy', 'w'),
bottleneck_features_train)
Comments
Post a Comment