2

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()])

`

  • Could the question be extended with more information, especially code? What does the TFF training code and the normal tensorflow environment code look lke? – Zachary Garrett Mar 14 '22 at 12:57

0 Answers0