Voxel51
Published in

Voxel51

FiftyOne Computer Vision Tips and Tricks — Nov 11, 2022

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.

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!

Filtering labels with ViewField

Community Slack member Geoffrey Keating asked,

“I have a function that takes a bounding box and margin of error to determine if the box is on the border of an image; could I use this in conjunction with ViewFieldto filter labels?”

First, a little background on ViewField. When you create a ViewField using a string field like ViewField(“$embedded.field.name”), the meaning of this field is interpreted relative to the context in which the ViewField object is used. For example, when passed to the ViewExpression.map()method, this object will refer to the embedded.field.nameobject of the array element being processed.

In other cases, you may wish to create a ViewField that always refers to the root document. You can do this by prepending “$” to the name of the field, as in ViewField(“$embedded.field.name”).

Here are two options that could work. The first one uses relative coordinates:

And here’s one that works in pixels:

Learn more about using ViewFields and expressions (with examples) in the FiftyOne Docs.

Filtering file paths for existing substrings

Community Slack member Adrian Loy asked and answered his own question!

“Is it possible to filter file paths for existing substrings?”

Yes! Use contains_str which determines whether the expression, which must resolve to a string, contains the given string or string(s).

Learn more about contains_strin the FiftyOne Docs.

Filtering labels based on detection IDs

Community Slack member Guillaume Dumont asked,

“Is it possible to filter labels based on detection IDs?”

Yes! Use select_labels():

Mistakenness probability and IoU default values

Community Slack member Laura Lin asked,

“For fiftyone.brain.compute_mistakenness, how are missing objects calculated? Is there a certain probability threshold that a prediction has to reach? Also, is there a certain IoU or IoA threshold that a detection and prediction bounding needs to meet before it is marked as missing/spurious?”

The confidence threshold for predictions to be marked as missing is currently hard coded at 0.95 and IoU at 0.5. In the future, it may make sense to expose these as parameters.

Learn more about computing mistakenness in the FiftyOne Docs.

Specifying colors for classes

Community Slack member Benjamin Fenker asked,

“I’d like to annotate a bounding box dataset and use the same colors for each class every time. So, dogs are blue, cats are red, etc. Can someone point me to how to set this up in the configs?”

At the moment, you can only provide a color pool to the App, from which colors are randomly pulled. However, this is a popular request! You can track this feature’s progress here.

If you are using our draw_labels() functionality to render images to disk with labels drawn on them, then you could iteratively draw one label class at a time with a set color:

What’s next?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store