Short background
Hello Im currently taking a course in Tensorflow on udemy Modified by moderator
However Im not getting the same results as they get in the course I have looked over everything and even started copied from course material just to see if I get same results. But no still awful results.
The reason I post here is that I do not get any answers from the those in charge of the courss (seems like they have abandon udemy for their own acadamy.
So that is why I post here. The data is downloaded from Tensorflow:
“food101”
Here is model:
from keras import layers
# Create base model
input_shape = (224, 224, 3)
base_model = tf.keras.applications.EfficientNetB0(include_top=False)
base_model.trainable = False # freeze base model layers
# Create Functional model
inputs = layers.Input(shape=input_shape, name="input_layer")
# Note: EfficientNetBX models have rescaling built-in but if your model didn't you could have a layer like below
x = base_model(inputs, training=False) # set base_model to inference mode only
x = layers.GlobalAveragePooling2D(name="pooling_layer")(x)
x = layers.Dense(len(class_names))(x) # want one output neuron per class
#x = layers.Rescaling(1./255)(x)
# Separate activation of output layer so we can output float32 activations
outputs = layers.Activation("softmax", dtype=tf.float32, name="softmax_float32")(x)
model = tf.keras.Model(inputs, outputs)
# Compile the model
model.compile(loss="sparse_categorical_crossentropy", # Use sparse_categorical_crossentropy when labels are *not* one-hot
optimizer=tf.keras.optimizers.Adam(),
metrics=["accuracy"])
Fitting the model:
# Turn off all warnings except for errors
tf.get_logger().setLevel('ERROR')
# Fit the model with callbacks
history_101_food_classes_feature_extract = model.fit(train_data,
epochs=3,
steps_per_epoch=len(train_data),
validation_data=test_data,
validation_steps=int(0.15 * len(test_data)),
callbacks=[create_tensorboard_callback("training_logs",
"efficientnetb0_101_classes_all_data_feature_extract"),
model_checkpoint])
Epoch 1/3
2368/2368 [==============================] - 200s 76ms/step - loss: 4.7007 - accuracy: 0.0098 - val_loss: 4.6932 - val_accuracy: 0.0162
Epoch 2/3
2368/2368 [==============================] - 175s 73ms/step - loss: 4.6949 - accuracy: 0.0105 - val_loss: 4.6840 - val_accuracy: 0.0072
Epoch 3/3
2368/2368 [==============================] - 173s 72ms/step - loss: 4.6886 - accuracy: 0.0108 - val_loss: 4.6873 - val_accuracy: 0.0072