Exporting Your Trained Model

Exporting Your Trained Model

PerceptiLabs allows you to export your model to TensorFlow's SavedModel format, resulting in the creation of a .pb model file.


You must first train your model in PerceptiLabs by clicking Run before it can be exported.

Follow the steps below to export your model:

  1. Ensure you have fully trained your model in PerceptiLabs.

  2. Navigate to File > Export.

  3. Click Browse to select a directory to export the model to.

  4. Set Export as to TensorFlow Model.

  5. (Optional) Select Compressed. This optimizes the exported model by quantizing integer values for all weights and activations from 32-bit to 8-bit using Post-training integer quantization.

  6. Click Export.

After the export is complete, a directory will be created in the location that you specified in Step 3, with the same name as your model. The structure of the directory will look as follows:


Within this directory is a numbered subdirectory (e.g., "1") representing the model version that contains the exported model binary file: saved_model.pb.

To use the exported model for inference, take the entire version directory (e.g., "1" directory) and use it for serving the model. This structure is standard for TensorFlow serving. The variables subdirectory contains a standard training checkpoint, this is needed to load the model unless it's frozen. A frozen model (or frozen graph) is a minimized model that can only be used for inference. All the variables needed for training are removed and the only variables that remain are stored together with their definitions in a single protobuf (.pb) file. Note that TensorFlow 2.0 no longer generates frozen graph models.

For additional information see Serving a TensorFlow Model.

Exporting a Jupyter Notebook File

PerceptiLabs allows you to export the code from your PerceptiLabs model to a Jupyter Notebook file so that you, or someone else, can edit and run your model's Python code from within Jupyter Notebooks.

Running or editing a model outside of the tool allows you to:

  • draft up a model using PerceptiLabs and then start custom editing it in code.

  • train the model in a pipeline without the need for a frontend interface.

For more information about running your exported notebook see Running a PerceptiLabs Model in Jupyter Notebook.

Follow the steps below to export your code:

  1. Navigate to File > Export.

  2. Click Browse to select a directory to export the file to.

  3. Set Export as to Jupyter Notebook (ipynb).

  4. Enter the desired file name into Name.

  5. Click Export.


The code in the cell(s) corresponding to your model's Data component(s), may contain paths to data files that require adjustment after exporting. This may be required so that the code can locate the data when executed as a Jupyter Notebook in a different environment.

Exporting Your Model to GitHub

PerceptiLabs allows you to export your model and its supporting files to a new repo under your existing GitHub account. This allows you to back up your model on GitHub, keep a revision history for each file, and share your model as a package with other PerceptiLabs users. As part of the export process, PerceptiLabs will also generate and include a template README.md file that you can modify to describe your repo in more detail.

Follow the steps below to export your model to GitHub:


You will need Git installed before you can perform these steps.

1. Ensure your model is saved by selecting File > Save.

2. Start the export by selecting File > Export to GitHub. Your browser will redirect you to the GitHub website which will request your authorization to allow PerceptiLabs to create a new repository under your GitHub user account and to push files to that repository. Once you've granted authorization to GitHub, your browser will redirect back to PerceptiLabs and display the Export to GitHub popup:

3. Enter a descriptive name to save the new repo.

4. (Optional) Enable Include TensorFlow Files if you want to include your trained TensorFlow model files (e.g., checkpoints, etc.) as part of the export. For a description of these files, see Exporting Your Trained Model above.

5. (Optional) Enable Include Data file if you want to include the files referenced by the Data component(s) of your model as part of the export.

6. Click Export to start the export process.

Last updated