2
$\begingroup$

Do I need to change my existing code I used to train neural network from my PC. here is my current code.

Model = Sequential()
Model.add(Convolution2D(32,3,3, input_shape=(128,128,3),activation="relu"))

Model.add(MaxPooling2D(pool_size=(2,2)))

Model.add(Convolution2D(32,3,3,activation="relu"))
Model.add(MaxPooling2D(pool_size=(2,2)))

Model.add(Flatten())

Model.add(Dense(output_dim =128, activation= 'relu'))
Model.add(Dense(output_dim =1, activation= 'sigmoid'))
Model.compile(optimizer="adam", loss = 'binary_crossentropy', metrics= ["accuracy"])

train_datagen = ImageDataGenerator(
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True)

test_datagen = ImageDataGenerator(rescale=1./255)

traning_set = train_datagen.flow_from_directory(
        'data/train_set',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')

test_set = test_datagen.flow_from_directory(
        'data/test_set',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')

classifier.fit_generator(
        traning_set,
        steps_per_epoch=204,
        epochs=20,
        validation_data=test_set,
        validation_steps=101)


classifier.save('mymodel.h5')
$\endgroup$
1
$\begingroup$

You should provide more information about the previous framework you used and your layer setup. I imagine you also want to "translate" your trained model into a proper weight format

| improve this answer | |
$\endgroup$
  • $\begingroup$ I updated question with my current coding. Is it possible for me to upload this coding to Google ML ? $\endgroup$ – Noob Coder Jan 9 '19 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.