Create an image classifier

In this guide we create an image classifier by extending model configuration from gpkg.slim, which is a Guild package that provides support for image classifiers implemented with TF-Slim.

TF-Slim provides state of the art image classification networks, including networks pretrained on ImageNet. TF-Slim is the basis for both the TensorFlow Object Detection API and TensorFlow Hub image classification modules.


TF-Slim is deprecated and no longer supported by the TensorFlow team. Nonetheless, it’s an important library that provides state of the art pretrained networks used by teams and engineers from Google and other organizations.


Create a project

Initialize a project environment

When working with projects, we recommend using a Guild environment to isolate project runs and installed Python packages. This ensures that work in one project does not conflict with work in other projects.

At a command prompt, ensure that you’re in the project directory:


Use the init command to initialize a Guild environment:

guild init

Guild prompts you before initialzing the environment in the project env directory with the default Python runtime and TensorFlow version for your system.

Press Enter to confirm.

Guild creates a new Python virtual environment in the project directory under env, which contains the Python runtime, installed Python packages, and project Guild home.

A project environment must be activated using the operation system source command.

Activate the project environment:

source guild-env

When an environment is activated in a command console, the command prompt shows the environment name in the format (<env name>) <default prompt>. The environment name is the project directory name by default but can be set using the ‑‑name when running guild init.


You must activate the project environment using source guild‑env each time you open a new command console for project work.

Verify that the environment is activated using the check command:

guild check

Guild shows environment details, including the location of Guild home, which is identified by guild_home in the output.

Confirm that the path for guild_home is in the project directory under env/.guild. If it is in a different location, verify the steps above to ensure that your project environment is initialized and activated.

Install gpkg.slim