On Mnist dataset, MobileNet is showing low accuracy in tff learning environment but shows high accuracy in tensorflow env. How to improve accuracy?

Viewed 108

The accuracy is stuck on 0.111 on every round. But the same model gives an accuracy of 91% in the normal tensorflow environment. The optimizer used in both scenarios is SGD. The model function : `

def model_fn():
 model=tf.keras.Sequential()
 model.add(tf.keras.applications.MobileNetV2(include_top = False, pooling = 'avg',
 weights = 'imagenet',input_shape=(96,96,3)))
 model.add(tf.keras.layers.Dense(10, activation = 'softmax'))
 model.layers[0].trainable = False
 return tff.learning.from_keras_model(model,input_spec=collections.OrderedDict([('x', 
 tf.TensorSpec(shape(None,96,96,3),dtype=tf.float32, name=None)),
         ('y', tf.TensorSpec(shape=(None,), dtype=tf.int32, name=None))]),
 loss=tf.keras.losses.SparseCategoricalCrossentropy(),
 metrics=[tf.keras.metrics.SparseCategoricalAccuracy()])

`

0 Answers
Related