Configuring FiftyOne¶
FiftyOne can be configured in various ways. This guide covers the various options that exist, how to view your current config, and how to customize your config as desired.
Configuration options¶
FiftyOne supports the configuration options described below:
Config field |
Environment variable |
Default value |
Description |
---|---|---|---|
|
|
|
The directory in which to store FiftyOne’s backing database. |
|
|
|
The default directory in which to store datasets that are downloaded from the FiftyOne Dataset Zoo. |
|
|
|
A list of manifest JSON files specifying additional zoo datasets. See adding datasets to the zoo for more information. |
|
|
|
The default directory to use when performing FiftyOne operations that
require writing dataset contents to disk, such as ingesting datasets via
|
|
|
|
The default ML backend to use when performing operations such as
downloading datasets from the FiftyOne Dataset Zoo that support multiple ML
backends. Supported values are |
|
|
|
A default batch size to use when applying models to datasets. |
|
|
|
A default error level to use when ensuring/installing requirements for models from the model zoo. See loading zoo models for more information. |
|
|
|
The default numeric string pattern to use when writing sequential lists of files. |
|
|
|
The default image format to use when writing images to disk. |
|
|
|
The default video format to use when writing videos to disk. |
|
|
|
The default port to use to serve the FiftyOne App. |
|
|
|
Whether to launch the FiftyOne App in the browser (False) or as a desktop App (True) by default. If True, the FiftyOne Desktop App must be installed. |
|
|
|
Controls whether UUID based import and App usage events are tracked. |
|
|
|
The default directory in which to store models that are downloaded from the FiftyOne Model Zoo. |
|
|
|
A list of manifest JSON files specifying additional zoo models. See adding models to the zoo for more information. |
|
|
|
Controls whether progress bars are printed to the terminal when performing operations such reading/writing large datasets or activiating FiftyOne Brain methods on datasets. |
Viewing your config¶
You can print your current FiftyOne config (including any customizations as described in the next section) at any time via the Python library and the CLI.
import fiftyone as fo
# Print your current config
print(fo.config)
# Print a specific config field
print(fo.config.default_ml_backend)
{
"database_dir": "~/.fiftyone/var/lib/mongo",
"dataset_zoo_dir": "~/fiftyone",
"dataset_zoo_manifest_paths": null,
"default_app_port": 5151,
"default_batch_size": null,
"default_dataset_dir": "~/fiftyone",
"default_ml_backend": "torch",
"default_sequence_idx": "%08d",
"default_image_ext": ".jpg",
"default_video_ext": ".mp4",
"desktop_app": false,
"do_not_track": false,
"model_zoo_dir": "~/fiftyone/__models__",
"model_zoo_manifest_paths": null,
"requirement_error_level": 0,
"show_progress_bars": true
}
torch
# Print your current config
fiftyone config
# Print a specific config field
fiftyone config default_ml_backend
{
"database_dir": "~/.fiftyone/var/lib/mongo",
"dataset_zoo_dir": "~/fiftyone",
"dataset_zoo_manifest_paths": null,
"default_app_port": 5151,
"default_batch_size": null,
"default_dataset_dir": "~/fiftyone",
"default_ml_backend": "torch",
"default_sequence_idx": "%08d",
"default_image_ext": ".jpg",
"default_video_ext": ".mp4",
"desktop_app": false,
"do_not_track": false,
"model_zoo_dir": "~/fiftyone/__models__",
"model_zoo_manifest_paths": null,
"requirement_error_level": 0,
"show_progress_bars": true
}
torch
Modifying your config¶
You can modify your FiftyOne config in a variety of ways. The following sections describe these options in detail.
Order of precedence¶
The following order of precedence is used to assign values to your FiftyOne config settings at runtime:
Config settings applied at runtime via
fiftyone.core.config.set_config_settings()
FIFTYONE_XXX
environment variablesSettings in your JSON config (
~/.fiftyone/config.json
)The default config values described in the table above
Editing your JSON config¶
You can permanently customize your FiftyOne config by creating a
~/.fiftyone/config.json
file on your machine. The JSON file may contain any
desired subset of config fields that you wish to customize.
For example, a valid config JSON file is:
{
"default_ml_backend": "tensorflow",
"show_progress_bars": true
}
When fiftyone
is imported, any options from your JSON config are applied,
as per the order of precedence described above.
Note
You can customize the location from which your JSON config is read by
setting the FIFTYONE_CONFIG_PATH
environment variable.
Setting environment variables¶
FiftyOne config settings may be customized on a per-session basis by setting
the FIFTYONE_XXX
environment variable(s) for the desired config settings.
When fiftyone
is imported, all config environment variables are applied, as
per the order of precedence described above.
For example, you can customize your FiftyOne config in a Terminal session by issuing the following commands prior to launching your Python interpreter:
export FIFTYONE_DEFAULT_ML_BACKEND=tensorflow
export FIFTYONE_SHOW_PROGRESS_BARS=true
Modifying your config in code¶
You can dynamically modify your FiftyOne config at runtime via the
fiftyone.core.config.set_config_settings()
method, which accepts keyword
arguments of the form (field name, field value)
for all available config
fields.
Any changes to your FiftyOne config applied via this manner will immediately
take effect in all subsequent calls to fiftyone.config
during your current
session.
For example, you can customize your FiftyOne config at runtime as follows:
1 2 3 4 5 6 | import fiftyone.core.config as foc
foc.set_config_settings(
default_ml_backend="tensorflow",
show_progress_bars=True,
)
|