Skip to content

Instantly share code, notes, and snippets.

View Sachin-crypto's full-sized avatar

Sachin Pal Sachin-crypto

View GitHub Profile
my_model = load_model("D:/SACHIN/Models/Hand-Sign-Digit-Language/digit_model.h5")
# Checking if the model exist otherwise save the model
if os.path.isfile("D:/SACHIN/Models/Hand-Sign-Digit-Language/digit_model.h5") is False:
model.save("D:/SACHIN/Models/Hand-Sign-Digit-Language/digit_model.h5")
# Running 10 epochs
model.fit(x=train_batches, validation_data=valid_batches, epochs=10, verbose=2)
model.compile(optimizer=Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy'])
# We are not going to train last 23 layers and it's an arbitrary number
for layer in mobile.layers[:-23]:
layer.trainable=False
model = Model(inputs=mobile.input, outputs=output)
# Removing last 6 layers and adding our output layer
x = mobile.layers[-6].output
output = Dense(units=10, activation='softmax')(x)
mobile = tf.keras.applications.mobilenet.MobileNet()