Skip to content

FiftyOne Tips and Tricks for Customizing your Computer Vision Workflows – Mar 03, 2023

Welcome to our weekly FiftyOne tips and tricks blog where we give practical pointers for using FiftyOne on topics inspired by discussions in the open source community. This week we’ll cover configuring FiftyOne and the FiftyOne App to craft your ideal experience working with computer vision data.

Wait, What’s FiftyOne?

FiftyOne is an open source machine learning toolset that enables data science teams to improve the performance of their computer vision models by helping them curate high quality datasets, evaluate models, find mistakes, visualize embeddings, and get to production faster.

FiftyOne quick overview gif

Ok, let’s dive into this week’s tips and tricks!

A primer on configurations

FiftyOne is built for flexibility, customization, and extensibility. Want to integrate with annotation tools? Check out our tight integrations with CVAT, Labelbox, and Label Studio. Want to work with benchmark datasets or evaluation routines? We’ve got you covered with native support for COCO, Open Images, and more. FiftyOne integrates seamlessly into a variety of computer vision workflows, allowing you to tailor your experience to your specific needs.

FiftyOne is made up of the FiftyOne Library, which is a software development kit (SDK), and the FiftyOne App, which is a GUI for visualizing and graphically interacting with your computer vision data. With FiftyOne configs, and FiftyOne App configs, each can be configured separately. You get control over everything from databases to ML backends, default file formats, and layout in the app.

Continue reading for some tips and tricks to help you fashion FiftyOne and the FiftyOne App using configs!

Access your configs

The first step on the way to customizing your configs is accessing them. Fortunately, in FiftyOne your config and app config are available in Python as properties.

To see the global FiftyOne config, use

import fiftyone as fo
print(fo.config)

And to get the global app config, run the similar command

import fiftyone as fo
print(fo.app_config)

Additionally, every session has its own app config, which can be accessed via the config property:

import fiftyone as fo
import fiftyone.zoo as foz

## load in dataset
dataset = foz.load_zoo_dataset("quickstart")

## create a session that doesn't display automatically
session = fo.launch_app(dataset, auto=False)

print(session.config)

Learn more about sessions in the FiftyOne Docs.

Modify your configs

Once you’ve identified your configs, there are multiple ways to modify them. If you want to set the default FiftyOne behavior to displaying progress bars, you can do so either by creating a JSON config file ~/.fiftyone/config.json with the code:

{
    "show_progress_bars": true
}

Or you can the corresponding environment variable from the command line:

export FIFTYONE_SHOW_PROGRESS_BARS=true

Lastly, you can achieve the same effect by setting the config directly in your Python code:

import fiftyone as fo
fo.config.show_progress_bars = True

Learn more about order of precedence for configs in the FiftyOne Docs.

Facilitate your ML workflows

With FiftyOne configs, you can set up FiftyOne for optimized use in your machine learning workflows. When downloading models from the FiftyOne Model Zoo, sometimes a model has both TensorFlow and PyTorch implementations available. By setting the default_ml_backend property in your FiftyOne config, you can specify the preferred ML library to use in these scenarios. 

If you prefer Pytorch over TensorFlow, you can make this the default:

import fiftyone as fo
fo.config.default_ml_backend = "torch"

Additionally, you can specify what batch size you wish to use, if any, when applying models from the model zoo to datasets. Running this sets the default batch size to 100 samples.

import fiftyone as fo
fo.config.default_batch_size = 100

Learn more about the API for FiftyOne’s Model Zoo in the FiftyOne Docs.

Enable plugins

By modifying your app config, you can enable plugins that customize and extend the behavior of FiftyOne. You can leverage built-in plugins like the Map panel or the 3D visualizer, or you can enable your own application-specific plugins!

Plugin configurations are controlled via the ”plugins” key in the app config. If you want to set the default camera position in the 3D visualizer, you can do so by modifying properties of the ”plugins.3d” config in ~/.fiftyone/app_config.json:

// The default values are shown below
{
    "plugins": {
        "3d": {
            // Whether to show the 3D visualizer
            "enabled": true,

            // The initial camera position in 3D space
            "defaultCameraPosition": {"x": 100, "y": 0, "z": 20},
      }
   }
}

When we use the app config to set the default camera position in the 3D visualizer, the Quickstart Groups dataset looks like this:

Quickstart Groups dataset with custom camera position for viewing data in the 3D visualizer (right).

Learn more about developing and installing plugins in the FiftyOne Docs.

Configure the app on a per-dataset basis

In addition to the global app config, each dataset has its own app config, stored in the dataset.app_config attribute. This allows you to configure behavior in the FiftyOne App on a per-dataset basis! 

Continuing on with the 3D visualizer plugin example above, let’s suppose we are working with a bunch of grouped datasets (with point clouds), and for most of them we want to use a default camera position specified in the App config JSON file, with z = 100 so we are looking top-down. However, we have one particular dataset for which we would like the default view to be profile.

We can set the default app config for this dataset in Python without changing the default for the rest of our datasets:

pos = {'x':100, 'y':0, 'z':0}
dataset.app_config.plugins["3d"]["defaultCameraPosition"] = pos

Learn more about dataset app configs in the FiftyOne Docs.

Join the FiftyOne community!

Join the thousands of engineers and data scientists already using FiftyOne to solve some of the most challenging problems in computer vision today!