Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # SETUP MODEL
  2. CLASSES = 3
  3. base_model = InceptionV3(weights='imagenet', include_top=False)
  4. x=base_model.output
  5. x=GlobalAveragePooling2D()(x)
  6. preds=Dense(CLASSES,activation='softmax')(x) #final layer with softmax activation
  7.  
  8. model=Model(inputs=base_model.input,outputs=preds)
  9.  
  10. # transfer learning
  11. for layer in base_model.layers:
  12. layer.trainable = False
  13.  
  14. model.compile(loss="categorical_crossentropy", optimizer='adam',metrics=["accuracy"])
  15.  
  16. # train the network
  17. print("[INFO] training network...")
  18. H = model.fit_generator(
  19. aug.flow(trainX, trainY, batch_size=BS),
  20. validation_data=(testX, testY),
  21. steps_per_epoch=len(trainX) // BS,
  22. epochs=EPOCHS, verbose=1, callbacks=[csv_logger])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement