fiftyone
fiftyone copied to clipboard
[FR] Support visualizing nested GeoLocations in the Map plugin
GeoLocations can sometimes be stored at a detection-level. It would be useful to be able to visualize each detection geolocation point in the map directly. Lassoing points could then either match samples with selected detections, or filter down to only the selected detections. I am leaning towards the latter.
The current workaround for this is to create a patches view and promote the geolocation field to the top level:
import fiftyone as fo
import fiftyone.zoo as foz
from fiftyone import ViewField as F
# Add random geolocation data as detection attributes for this example
import random
dataset = foz.load_zoo_dataset("quickstart")
for sample in dataset:
for det in sample.ground_truth.detections:
det["det_loc"] = fo.GeoLocation(
point=[random.uniform(-180,180), random.uniform(-90,90)]
)
sample.save()
# Add a sample field that we can set in the future
dataset.add_sample_field("location", ftype=fo.EmbeddedDocumentField, embedded_doc_type=fo.GeoLocation)
# Create a patches view, make sure to carry of the location field added previously
view = dataset.to_patches("ground_truth", other_fields="location")
# Temporarily set the values of the "location" field to the corresponding detection location attribute for each patch
view = view.set_field("location", F("ground_truth.det_loc"))
session = fo.launch_app(view)