This describes how to view an ML model in an interactive webpage using the MLTK's commands/APIs.
_Any_ `.tflite` or `.h5` model file will work with the model visualizer.
i.e. The model file does _not_ need to be generated by the MLTK to view the model.
- Command-line: mltk view --help
- Python API: view_model
- Python API examples: view_model.ipynb
Model visualization allows for viewing how the various layers of a model are connected. Model visualization is enabled using the Netron machine learning model viewer, a tool for viewing models in an interactive webpage.
- Model visualization is done _entirely_ in the local web-browser. The model is _not_ uploaded to any remote servers
- Models may also be viewed by dragging and dropping a `.tflite` or `.h5` model file on the [http://netron.app](https://netron.app) webpage
Model visualization from the command-line is done using the view
operation.
For more details on the available command-line options, issue the command:
mltk view --help
In this example, we view the trained .h5
model file in the
image_classification model's archive.
NOTE: The model graph will appear in your web-browser.
mltk view image_classification
In this example, we view the trained .tflite
model file in the
image_classification model's archive.
NOTE: The model graph will appear in your web-browser.
mltk view image_classification --tflite
The given model need not be generated by the MLTK.
External models are also supported by the view
command.
NOTE: The model graph will appear in your web-browser.
mltk view ~/workspace/my_model.tflite
Training a model can be very time-consuming, and it is useful to view a
model before investing time and energy into training it.
For this reason, the MLTK view
command features a --build
flag to build a model
and view it before the model is fully trained.
In this example, the image_classification model is built at command-execution-time and this file is opened in the viewer. Note that only the model specification script is required, it does not need to be trained first.
NOTE: The model graph will appear in your web-browser.
mltk view image_classification --tflite --build
Model visualization is accessible via the view_model API
Examples using this API may be found in view_model.ipynb