Skip to content

FiftyOne Computer Vision Tips and Tricks – July 21, 2023

Welcome to our weekly FiftyOne tips and tricks blog where we recap interesting questions and answers that have recently popped up on Slack, GitHub, Stack Overflow, and Reddit.

As an open source community, the FiftyOne community is open to all. This means everyone is welcome to ask questions, and everyone is welcome to answer them. Continue reading to see the latest questions asked and answers provided!

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!

More effective FiftyOne source code searches

Community Slack member ZKW asked:

“I can’t find the source code of the dataset.export(...) definition in the FiftyOne GitHub repo when searching for the keywords ‘def export('. Is there another method for searching code in this repo?

Yes! Check out the Docs on custom exporters, the exporters.py file and the results of this search. There are two additional places you can perform searches besides GitHub: 

Renaming semantic mask paths

Community Slack member Guillaume asked:

“When I try to rename the semantic mask paths using the code below, I get ‘None’.”

old_root = "/old/path/to/data"
new_root = "/new/path/to/data"
print(dataset.first().groundtruth_segmentation.mask_path)
# /old/path/to/data/masks/0001.png
view = dataset.set_field("groundtruth_segmentation.mask_path", F("groundtruth_segmentation.mask_path").replace(old_root, new_root))
print(view.first().groundtruth_segmentation.mask_path)
# None

“To me, the mask_path is a StringField, so I don’t understand what is wrong.”

A few solutions:

Replace F("groundtruth_segmentation.mask_path") with F("$groundtruth_segmentation.mask_path"). Using the $ prefix is interpreted with respect to the root of the sample.

You could also use F("mask_path") instead. The key is that in this operation:

dataset.set_field("foo.bar.spam.eggs", expr)

..the expr is applied one level up from the leaf. In other words, it is applied to foo.bar.spam.

Learn more about the mask attribute in the FiftyOne Docs.

Working with cloud-based notebooks using proxy_url

Community Slack member ZKW asked:

“What is an example use case for the new feature that gives you the ability to specify a proxy_url (which overrides the server URL) in the App config?”

The most common use case where this feature would be useful is when working in a cloud-based Jupyter notebook (ideally in a VPN so the URL is not publicly accessible). In order for App cells to display, the session must have this proxy URL for iframes to connect successfully as the session is not running locally. For example, you might have a notebook server running on localhost:5151 that is accessible on a corporate VPN through https://company-notebooks.local/5151

Learn more about the proxy_url setting in the FiftyOne Docs.

Exporting and sharing dataset views

Community Slack member Namrata asked:

“Is there a way to export/share a dataset view with someone else?”

Yes! FiftyOne Teams is specifically designed to make collaborating a simple and secure operation. With FiftyOne Teams, admins can assign one of four roles to a dataset: Admin, Member, Collaborator, or Guest. 

When a user is granted a Collaborator role, it means that they’ll have access to datasets to which they have been invited, and their access will be Can view or Can edit access to datasets.

Collaborators cannot create new datasets, clone existing datasets, or view other users of the deployment. Collaborators may export datasets to which they’ve been granted access.

Learn more about all of the FiftyOne Teams roles in the FiftyOne Docs, or dive straight into the Collaborator role.

Making label boxes “invisible”

Community Slack member Vagif asked:

“By default, when the FiftyOne App loads a dataset, all the label boxes appear visible on the images. How can I make all the label boxes invisible until their checkboxes are ticked in the sidebar? In other words, I am looking for the equivalent of the “clear shown labels” button, but invoked through code.”

One way to accomplish this is to tag the samples you are interested in seeing the bounding boxes for and then creating a view for them that you can switch between, easily. Tagging can happen manually in the App or in code. You can use the tag_samples() and untag_samples() methods to add or remove sample tags from the samples in a view.

You can find more information on tagging contents 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!