Closed stevezkw1998 closed 1 year ago
Hi @stevezkw1998 👋
FiftyOne requires polyline and bounding box coordinates to be provided as relative values in [0, 1]
:
https://docs.voxel51.com/user_guide/using_datasets.html#polylines-and-polygons
Hi @stevezkw1998 👋
FiftyOne requires polyline and bounding box coordinates to be provided as relative values in
[0, 1]
: https://docs.voxel51.com/user_guide/using_datasets.html#polylines-and-polygons /
Hi @brimoor Thank you for your comments, I've converted the points to range (0, 1), but still couldn't see the polylines
modified
import json
import fiftyone as fo # Load the JSON file
with open("./polygons.json", "r") as f:
data = json.load(f) # Create an empty dataset
# Populate the dataset with samples and annotations
dataset = fo.Dataset(name="my_polygon_dataset")
for item in data:
filepath = item["filepath"]
annotations = item["annotations"] # Create a FiftyOne sample with the image
image_height = item["imageHeight"]
image_width = item["imageWidth"]
# Convert the annotations to FiftyOne format
sample = None
sample = fo.Sample(filepath=filepath)
polylines = []
for ann in annotations:
label = ann["label"]
points = ann["points"] # Add the polygon annotation'
points = [[(float(x)/image_width, float(y)/image_height)] for x, y in points]
# Add the polygons to the sample
polyline = fo.Polyline(label=label, points=points, closed=True, filled=True, color="red")
polylines.append(polyline)
polylines = fo.Polylines(polylines=polylines)
sample['ground_truth'] = polylines # Add the sample to the dataset
dataset.add_sample(sample.copy()) # Launch the FiftyOne App
session = fo.launch_app(dataset)
Hi @brimoor , Polylines visualization issue was fixed, after I calibrated the format by myself, FYI
Original:
points = [[(float(x)/image_width, float(y)/image_height)] for x, y in points]
After change:
points = [[(float(x)/image_width, float(y)/image_height) for x, y in points]]
System information
python --version
): Python 3.9.16fiftyone --version
): 0.19.1Describe the problem
files![image](https://user-images.githubusercontent.com/53121066/226076387-ff30fb27-a0f4-40f6-a343-f468f707e2a8.png)
fiftyone App
No labels displayed
Sample in fiftyone App
No labels displayed
Code to reproduce issue
polygons.json
Run Script script.py
Other info/logs
One sample's JSON
What areas of FiftyOne does this bug affect?
App
: FiftyOne application issueCore
: Core Python library issueServer
: FiftyOne server issueWillingness to contribute
The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?