package documentation

The FiftyOne Model Zoo.

Copyright 2017-2025, Voxel51, Inc.

Module torch FiftyOne Zoo models provided by torchvision:torchvision.models.

From __init__.py:

Class HasZooModel Mixin class for Config classes of fiftyone.core.models.Model instances whose models are stored in the FiftyOne Model Zoo.
Class RemoteModelManager Undocumented
Class RemoteModelManagerConfig Undocumented
Class RemoteZooModel Undocumented
Class RemoteZooModelsManifest Class that describes the collection of remotely-sourced models in the FiftyOne Model Zoo.
Class ZooModel Class describing a model in the FiftyOne Model Zoo.
Class ZooModelsManifest Class that describes the collection of models in the FiftyOne Model Zoo.
Function delete_zoo_model Deletes the zoo model from local disk, if necessary.
Function delete_zoo_model_source Deletes the specified remote source and all downloaded models associated with it.
Function download_zoo_model Downloads the specified model from the FiftyOne Model Zoo.
Function ensure_zoo_model_requirements Ensures that the package requirements for the specified zoo model are satisfied.
Function find_zoo_model Returns the path to the zoo model on disk.
Function get_zoo_model Returns the ZooModel instance for the specified zoo model.
Function install_zoo_model_requirements Installs any package requirements for the specified zoo model.
Function is_zoo_model_downloaded Determines whether the zoo model of the given name is downloaded.
Function list_downloaded_zoo_models Returns information about the zoo models that have been downloaded.
Function list_zoo_model_sources Returns the list of remote model sources that are registered locally.
Function list_zoo_models Returns the list of available models in the FiftyOne Model Zoo.
Function load_zoo_model Loads the specified model from the FiftyOne Model Zoo.
Function register_zoo_model_source Registers a remote source of models, if necessary.
Constant MODELS_MANIEST_FILENAME Undocumented
Variable logger Undocumented
Function _download_archive Undocumented
Function _download_model_metadata Undocumented
Function _download_remote_model Undocumented
Function _get_cache_key Undocumented
Function _get_exact_model Undocumented
Function _get_latest_model Undocumented
Function _get_model Undocumented
Function _get_model_in_dir Undocumented
Function _import_zoo_module Undocumented
Function _iter_model_manifests Undocumented
Function _list_zoo_models Undocumented
Function _load_remote_model Undocumented
Function _load_zoo_models_manifest Undocumented
Function _merge_manifest Undocumented
Function _merge_remote_manifest Undocumented
Function _normalize_ref Undocumented
Function _parse_model_identifier Undocumented
Constant _BUILTIN_MODELS_MANIFEST_PATT Undocumented
Constant _MODELS Undocumented
Constant _THIS_DIR Undocumented
def delete_zoo_model(name): (source)

Deletes the zoo model from local disk, if necessary.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
def delete_zoo_model_source(url_or_gh_repo): (source)

Deletes the specified remote source and all downloaded models associated with it.

Parameters
url_or_gh_repo

the remote source to delete, which can be:

  • a GitHub repo URL like https://github.com/<user>/<repo>
  • a GitHub ref like https://github.com/<user>/<repo>/tree/<branch> or https://github.com/<user>/<repo>/commit/<commit>
  • a GitHub ref string like <user>/<repo>[/<ref>]
  • a publicly accessible URL of an archive (eg zip or tar) file
def download_zoo_model(name_or_url, model_name=None, overwrite=False): (source)

Downloads the specified model from the FiftyOne Model Zoo.

If the model is already downloaded, it is not re-downloaded unless overwrite == True is specified.

Note

To download from a private GitHub repository that you have access to, provide your GitHub personal access token by setting the GITHUB_TOKEN environment variable.

Parameters
name_or_url

the name of the zoo model to download, which can have @<ver> appended to refer to a specific version of the model, or the remote source to download it from, which can be:

  • a GitHub repo URL like https://github.com/<user>/<repo>
  • a GitHub ref like https://github.com/<user>/<repo>/tree/<branch> or https://github.com/<user>/<repo>/commit/<commit>
  • a GitHub ref string like <user>/<repo>[/<ref>]
  • a publicly accessible URL of an archive (eg zip or tar) file
model_name:Nonethe specific model to download, if name_or_url is a remote source
overwrite:Falsewhether to overwrite any existing files
Returns
tuple of
  • model: the ZooModel for the model
  • model_path: the path to the downloaded model on disk
def ensure_zoo_model_requirements(name, error_level=None, log_success=True): (source)

Ensures that the package requirements for the specified zoo model are satisfied.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
error_level:None

the error level to use when installing/ensuring requirements, defined as:

  • 0: raise error if a requirement is not satisfied
  • 1: log warning if a requirement is not satisfied
  • 2: ignore unsatisfied requirements

By default, fo.config.requirement_error_level is used

log_success:Truewhether to generate a log message when a requirement is satisfied
def find_zoo_model(name): (source)

Returns the path to the zoo model on disk.

The model must be downloaded. Use download_zoo_model to download models.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
Returns
the path to the model on disk
Raises
ValueErrorif the model does not exist or has not been downloaded
def get_zoo_model(name): (source)

Returns the ZooModel instance for the specified zoo model.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
Returns
a ZooModel
def install_zoo_model_requirements(name, error_level=None): (source)

Installs any package requirements for the specified zoo model.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
error_level:None

the error level to use, defined as:

  • 0: raise error if a requirement install fails
  • 1: log warning if a requirement install fails
  • 2: ignore install fails requirements

By default, fo.config.requirement_error_level is used

def is_zoo_model_downloaded(name): (source)

Determines whether the zoo model of the given name is downloaded.

Parameters
namethe name of the zoo model, which can have @<ver> appended to refer to a specific version of the model
Returns
True/False
def list_downloaded_zoo_models(): (source)

Returns information about the zoo models that have been downloaded.

Returns
a dict mapping model names to (model path, ZooModel) tuples
def list_zoo_model_sources(): (source)

Returns the list of remote model sources that are registered locally.

Returns
the list of remote sources
def list_zoo_models(tags=None, source=None): (source)

Returns the list of available models in the FiftyOne Model Zoo.

Also includes models from any remote sources that you've registered.

Example usage:

import fiftyone as fo
import fiftyone.zoo as foz

#
# List all zoo models
#

names = foz.list_zoo_models()
print(names)

#
# List all zoo models with the specified tag(s)
#

names = foz.list_zoo_models(tags="torch")
print(names)
Parameters
tags:Noneonly include models that have the specified tag or list of tags
source:Noneonly include models available via the given remote source
Returns
a list of model names
def load_zoo_model(name_or_url, model_name=None, download_if_necessary=True, ensure_requirements=True, install_requirements=False, error_level=None, cache=True, **kwargs): (source)

Loads the specified model from the FiftyOne Model Zoo.

By default, the model will be downloaded if necessary, and any documented package requirements will be checked to ensure that they are installed.

Note

To download from a private GitHub repository that you have access to, provide your GitHub personal access token by setting the GITHUB_TOKEN environment variable.

Parameters
name_or_url

the name of the zoo model to load, which can have @<ver> appended to refer to a specific version of the model, or the remote source to load it from, which can be:

  • a GitHub repo URL like https://github.com/<user>/<repo>
  • a GitHub ref like https://github.com/<user>/<repo>/tree/<branch> or https://github.com/<user>/<repo>/commit/<commit>
  • a GitHub ref string like <user>/<repo>[/<ref>]
  • a publicly accessible URL of an archive (eg zip or tar) file
model_name:Nonethe specific model to load, if name_or_url is a remote source
download_if_necessary:Truewhether to download the model if necessary
ensure_requirements:Truewhether to ensure any requirements are installed before loading the model
install_requirements:Falsewhether to install any requirements before loading the model
error_level:None

the error level to use when installing/ensuring requirements, defined as:

  • 0: raise error if a requirement is not satisfied
  • 1: log warning if a requirement is not satisfied
  • 2: ignore unsatisfied requirements

By default, fo.config.requirement_error_level is used

cache:Truewhether to store a weak reference to the model so that running this method again will return the same instance while the model is still in use
**kwargskeyword arguments to inject into the model's Config instance
Returns
a fiftyone.core.models.Model
def register_zoo_model_source(url_or_gh_repo, overwrite=False): (source)

Registers a remote source of models, if necessary.

Note

To download from a private GitHub repository that you have access to, provide your GitHub personal access token by setting the GITHUB_TOKEN environment variable.

Parameters
url_or_gh_repo

the remote source to register, which can be:

  • a GitHub repo URL like https://github.com/<user>/<repo>
  • a GitHub ref like https://github.com/<user>/<repo>/tree/<branch> or https://github.com/<user>/<repo>/commit/<commit>
  • a GitHub ref string like <user>/<repo>[/<ref>]
  • a publicly accessible URL of an archive (eg zip or tar) file
overwrite:Falsewhether to overwrite any existing files
MODELS_MANIEST_FILENAME: str = (source)

Undocumented

Value
'manifest.json'

Undocumented

def _download_archive(url, outdir): (source)

Undocumented

def _download_model_metadata(url_or_gh_repo, overwrite=False): (source)

Undocumented

def _download_remote_model(model_name, model_path): (source)

Undocumented

def _get_cache_key(name, **kwargs): (source)

Undocumented

def _get_exact_model(name): (source)

Undocumented

def _get_latest_model(base_name): (source)

Undocumented

def _get_model(name_or_url, model_name=None): (source)

Undocumented

def _get_model_in_dir(name_or_url, model_name=None): (source)

Undocumented

def _import_zoo_module(model_dir): (source)

Undocumented

def _iter_model_manifests(root_dir=None): (source)

Undocumented

def _list_zoo_models(tags=None, source=None): (source)

Undocumented

def _load_remote_model(model_name, model_path, **kwargs): (source)

Undocumented

def _load_zoo_models_manifest(): (source)

Undocumented

def _merge_manifest(manifest, manifest_path, sources=None): (source)

Undocumented

def _merge_remote_manifest(manifest, sources, manifest_path): (source)

Undocumented

def _normalize_ref(url_or_gh_repo): (source)

Undocumented

def _parse_model_identifier(url_or_gh_repo, overwrite=False): (source)

Undocumented

_BUILTIN_MODELS_MANIFEST_PATT = (source)

Undocumented

Value
os.path.join(_THIS_DIR, 'manifest-*.json')
_THIS_DIR = (source)

Undocumented

Value
os.path.dirname(os.path.abspath(__file__))