i have a question about the optimizer, can i change the optimizer?if i can, where i can find the code?
optimizer_v2.py
in the screenshot you shared has the base class tensorflow/tensorflow/python/keras/optimizer_v2/optimizer_v2.py at v2.5.0 · tensorflow/tensorflow · GitHub . As it says in the doc string: " You should not use this class directly, but instead instantiate one of its subclasses such as tf.keras.optimizers.SGD
, tf.keras.optimizers.Adam
, etc."
You can use a number of built-in optimizers from this list of APIs:
Hope this helps
The ML Basics section (with Keras) in Core TensorFlow tutorials may be a good start:
Note that in the beginner tutorials when you specify the optimizer inside the compile
method, you use the alias (e.g. 'adam'
).
Later on, as you get to the advanced tutorials, you may notice you can state the optimizers using the full API names, such as optimizer = tf.keras.optimizers.SGD(learning_rate=0.01)
:
sorry but i’m new with this, recently i trying to learn image classification from this tutorial
“Image classification with TensorFlow Lite Model Maker” and there is a code like the one below
“model = image_classifier.create(train_data, validation_data=validation_data, epochs=10)”
so if the code is like that, how can i add the “tf.keras.optimizers.Adam” if i want to put in that code
Sorry, but still can’t understand how to run this below code from the “Image classification with TensorFlow Lite Model Maker” tutorial with different optimizer , can you please tell me how?
“model = image_classifier.create(train_data, validation_data=validation_data, epochs=10)”
Hi @Yirmeyahu_Pakpahan , currently TensorFlow Lite Model Maker doesn’t provide such customization.
We are only targeting at easy-to-use interface for creating a model, instead of swapping every bit of modules. Usually, changing learning_rate and epochs will be the option to tune model quality.
(BTW, if you are interested in adding this feature, you can contribute code to Model Maker’s repo, and make it work in nightly version.)