-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for rendering attributes of detections in expanded sample view #452
Comments
Is there any way to add these attributes to sample fields so that Like this in doc sample, age and cute are included:
|
@jguo1002 Yes, this is best done through the Python API. When creating a label, you can add custom attributes to it like so: # Provide some default fields
label = fo.Classification(label="cat", confidence=0.98)
# Add custom label subfields
label["int"] = 5
label["float"] = 51.0
label["list"] = [1, 2, 3]
label["bool"] = True
label["dict"] = {"key": ["list", "of", "values"]} |
@ehofesmann Thanks for the follow-up! Two questions. First, these are examples with
I added the label attributes but the custom fields are not added to the sample fields, the subfields of Sample:
Sample field:
Second, I want to add custom attributes as object detections not classifications. Here the
Is there any way to work it out? Or did I miss anything? Thank you! |
I found a temporary solution that is to create a custom Detection class. # fiftytwo/labels.py
import fiftyone as fo
import fiftyone.core.fields as fof
class CustomDetection(fo.Detection):
age= fof.IntField()
cute= fof.BooleanField()
class CustomDetections(fo.Detections):
detections = fof.ListField(fof.EmbeddedDocumentField(CustomDetection)) It added print(dataset.view) ...
Sample fields:
...
ground_truth: fiftyone.core.fields.EmbeddedDocumentField(fiftytwo.labels.CustomDetections)
But now I still need to change a lot in both frontend and backend since the label path is hardcoded. For example: // @fiftyone/utilities
export const LABELS_PATH = "fiftyone.core.labels"; # fiftyone/core/patches.py
_SINGLE_TYPES_MAP = {
fol.Detections: fol.Detection,
fol.Polylines: fol.Polyline,
} Any other ways? |
Hey @jguo1002 just confirming that we are working on a feature that will allow custom attributes of We're considering two possible approaches to this:
This feature is currently blocked by the need to improve the App's performance a bit so that it scale to dataset's with more embedded fields in their schemas (but that's being actively worked on and this is next!) |
@brimoor Thanks for the follow-up! Looking forward to this feature! |
Object detections can contain custom attributes in two ways:
age
,happiness
,breed
,cute
below)attributes
field, which contains a dict mapping attribute names tofiftyone.core.label.Attribute
instances, which can beCategoricalAttribute
,NumericAttribute
, orBooleanAttribute
instancesIf the user provides either of these types of data on their detections, they should be able to see these fields rendered in Player51, using its attribute panel feature:
For example, the data below should be rendered as:
Note that detections could have other fields with unsupported types like dict (other than
attributes
, which specifically is supported because its contents are known to beAttribute
instances), list, numeric arrays, etc. Such fields should be ignored for visualization purposes.We should include a reasonable overflow behavior, such as replace attributes 5+ with
...
Also, since these attributes can take up a lot of space, we should expose an option in the Player51 controls to toggle whether the attributes are displayed or not. We don't need the extra options related to
attr: value
vslist, of, attrs
formatting. Either they render inattr: value
syntax or not at allThe text was updated successfully, but these errors were encountered: