FiftyOne CLI Tips and Tricks!

Daniel Gural
Voxel51
Published in
5 min readAug 25, 2023

Welcome to our weekly FiftyOne tips and tricks blog where we cover interesting workflows and features of FiftyOne! This week, we’ll be exploring FiftyOne’s Command Line Interface.

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.

Ok, let’s dive into this week’s tips and tricks! Also feel free to follow along in our notebook or on YouTube!

Navigating the FiftyOne CLI

Leveraging CLI commands can be a powerful way to streamline your workflow. We will do a quick dive on some powerful options FiftyOne provides that can save you time on your next computer vision project. Let’s take a look.

To start, let’s first turn on auto completion in the terminal. To complete any FiftyOne command just tab to see all your options. For bash, enter the command below. If you use a different terminal type, look here.

eval "$(register-python-argcomplete fiftyone)"

Viewing Your Datasets

Sometimes, you just want to find out which datasets you have on the fly. The CLI offers the fiftyone datasets list command to show all your currently available datasets. It is easy for you to now know which can be loaded into the App, double check any spellings, or check if it is time to clean up some of those old datasets!

fiftyone datasets list
open-images-v6-validation-200 
quickstart
tips+tricks

Pruning Old Datasets

We’ve all been there. That giant dataset you meant to delete a year ago is still sitting on your machine, hiding behind hundreds of other files. With the CLI, we can sort our datasets by their creation date and delete the ones we don’t need anymore. Let’s see how:

fiftyone datasets info --sort-by created_at
name                           created_at           last_loaded_at       version    persistent    media_type    tags    num_samples
----------------------------- ------------------- ------------------- --------- ------------ ------------ ------ -------------
tips_and_tricks 2023-08-24 18:47:00 2023-08-24 18:55:23 0.21.6 ✓ image 200
open-images-v6-validation-200 2023-06-29 19:17:58 2023-08-24 17:44:21 0.21.6 ✓ image 200
evaluate-detections-tutorial 2023-06-28 20:27:39 2023-08-24 17:55:04 0.21.6 ✓ image 5005

In our example, the evaluate-detections-tutorial dataset is past its time and is ready to be deleted. Let's remove it with the following:

fiftyone datasets delete evaluate-detections-tutorial

Looking Closer at Your Datsets

Another common use case you can find yourself in is quickly needing to grab some basic information about your datasets. No need to boot up the App or open up the Python kernel, quick information can be grabbed straight from the CLI. Here are two quick examples:

What is the size of my dataset on disk?

fiftyone datasets stats quickstart
key            value
------------- -------
samples_count 200
samples_bytes 1270762
samples_size 1.2MB
total_bytes 1270762
total_size 1.2MB

Did I add my predictions to my dataset?

fiftyone datasets info quickstart
Name:        quickstart
Media type: image
Num samples: 200
Persistent: True
Tags: []
Sample fields:
id: fiftyone.core.fields.ObjectIdField
filepath: fiftyone.core.fields.StringField
tags: fiftyone.core.fields.ListField(fiftyone.core.fields.StringField)
metadata: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.metadata.ImageMetadata)
ground_truth: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections)
uniqueness: fiftyone.core.fields.FloatField
predictions: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections)

Draw on Labels with CLI

FiftyOne makes it incredibly easy to visualize and inspect predictions that are added to the dataset. If you have a dataset where you are really proud of your predictions, or maybe a prediction that needs to be sent to another data science team, samples can be exported with their drawn on labels. It is easy and seamless to perform this with the CLI, all you need is the name of the dataset and label field!

fiftyone datasets draw -d drawn_labels -f predictions quickstart
100% |█████████████████| 200/200 [20.9s elapsed, 0s remaining, 8.4 samples/s] 
Rendered media written to 'drawn_labels'

FiftyOne Plugin CLI

Plugins are a hot topic in the FiftyOne universe. With the ability to extend the FiftyOne App’s capabilities with easy to write Python code, the possibilities with FIftyOne Plugins are endless! Check out the AI Art Gallery, VoxelGPT, or the Plugins Repo! Let’s explore the Plugins CLI:

To download a plugin:

fiftyone plugins download https://github.com/path/to/repo

To explore what plugins are installed and operators they contain, look for the following:

fiftyone plugins list
plugin                version    enabled    directory
-------------------- --------- --------- ---------------------------------------------------
@voxel51/hello-world 1.0.0 ✓ /home/dan/fiftyone/__plugins__/@voxel51/hello-world
@voxel51/voxelgpt 1.0.0 ✓ /home/dan/fiftyone/__plugins__/@voxel51/voxelgpt
@voxel51/io 1.0.0 ✓ /home/dan/fiftyone/__plugins__/@voxel51/io
fiftyone operators list
uri                                               enabled    builtin    on_startup    unlisted    dynamic
------------------------------------------------ --------- --------- ------------ ---------- ---------
@voxel51/hello-world/count ✓
@voxel51/voxelgpt/ask_voxelgpt ✓
@voxel51/voxelgpt/ask_voxelgpt_panel ✓ ✓
@voxel51/voxelgpt/open_voxelgpt_panel ✓ ✓
@voxel51/voxelgpt/open_voxelgpt_panel_on_startup ✓ ✓ ✓
@voxel51/voxelgpt/vote_for_query ✓ ✓
@voxel51/io/add_samples ✓ ✓
@voxel51/io/export_samples ✓ ✓
@voxel51/operators/clone_selected_samples ✓ ✓ ✓
@voxel51/operators/clone_sample_field ✓ ✓ ✓
@voxel51/operators/rename_sample_field ✓ ✓ ✓
@voxel51/operators/delete_selected_samples ✓ ✓ ✓
@voxel51/operators/delete_sample_field ✓ ✓ ✓
@voxel51/operators/print_stdout ✓ ✓ ✓

To disable or enable a plugin:

fiftyone plugins disable @voxel51/hello-world 
fiftyone plugins enable @voxel51/hello-world

Keep an eye out for more exciting plugin content as we kick off our 10 Weeks of Plugins! Hopefully, these tips will help you speed up your workflows and create a better computer vision experience on your next project! Good Luck!

To learn more about the FiftyOne CLI head over to our CLI Docs for more information!

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!

What’s Next?

Originally published at https://voxel51.com on August 25, 2023.

--

--