import fiftyone as fo
import fiftyone.zoo as foz
dataset = foz.load_zoo_dataset(
"quickstart",
dataset_name="skeletons",
)
session = fo.launch_app(dataset)
Dataset already downloaded Loading 'quickstart' 100% |█████████████████| 200/200 [2.4s elapsed, 0s remaining, 82.8 samples/s] Dataset 'skeletons' created
Could not connect session, trying again in 10 seconds
dataset.skeletons = {
"points": fo.KeypointSkeleton(
labels=[
"left hand" "left shoulder", "right shoulder", "right hand",
"left eye", "right eye", "mouth",
],
edges=[[0, 1, 2, 3], [4, 5, 6]],
)
}
dataset.save()
!export FIFTYONE_CVAT_USERNAME=""
!export FIFTYONE_CVAT_PASSWORD=""
ann_view = dataset.match_tags("annotate")
ann_view
Dataset: skeletons Media type: image Num samples: 1 Sample fields: id: fiftyone.core.fields.ObjectIdField filepath: fiftyone.core.fields.StringField tags: fiftyone.core.fields.ListField(fiftyone.core.fields.StringField) metadata: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.metadata.ImageMetadata) ground_truth: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections) uniqueness: fiftyone.core.fields.FloatField predictions: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections) View stages: 1. MatchTags(tags=['annotate'], bool=True, all=False)
# A unique identifer for this run
anno_key = "skeletons51"
# Upload the sample and launch CVAT
anno_results = ann_view.annotate(
anno_key,
label_field="points",
label_type="keypoints",
classes=["person"],
launch_editor=True,
)
Computing metadata... 100% |█████████████████████| 1/1 [155.0ms elapsed, 0s remaining, 6.5 samples/s] Uploading samples to CVAT... Launching editor at 'http://localhost:8080/tasks/18/jobs/18'...
anno_results.get_status()
{'points': {18: {'name': 'FiftyOne_skeletons', 'status': 'completed', 'assignee': None, 'last_updated': '2023-09-15T15:34:40.809777Z', 'jobs': {18: {'url': 'http://localhost:8080/api/jobs/18', 'id': 18, 'task_id': 18, 'project_id': None, 'assignee': None, 'guide_id': None, 'dimension': '2d', 'bug_tracker': None, 'status': 'completed', 'stage': 'acceptance', 'state': 'completed', 'mode': 'annotation', 'frame_count': 1, 'start_frame': 0, 'stop_frame': 0, 'data_chunk_size': 72, 'data_compressed_chunk_type': 'imageset', 'created_date': '2023-09-15T15:33:36.292099Z', 'updated_date': '2023-09-15T15:34:40.792068Z', 'issues': {'url': 'http://localhost:8080/api/issues?job_id=18', 'count': 0}, 'labels': {'url': 'http://localhost:8080/api/labels?job_id=18', 'count': 1}, 'type': 'annotation', 'organization': None}}}}}
result = ann_view.load_annotation_results(anno_key)
result.get_status()
{'points': {18: {'name': 'FiftyOne_skeletons', 'status': 'completed', 'assignee': None, 'last_updated': '2023-09-15T15:34:40.809777Z', 'jobs': {18: {'url': 'http://localhost:8080/api/jobs/18', 'id': 18, 'task_id': 18, 'project_id': None, 'assignee': None, 'guide_id': None, 'dimension': '2d', 'bug_tracker': None, 'status': 'completed', 'stage': 'acceptance', 'state': 'completed', 'mode': 'annotation', 'frame_count': 1, 'start_frame': 0, 'stop_frame': 0, 'data_chunk_size': 72, 'data_compressed_chunk_type': 'imageset', 'created_date': '2023-09-15T15:33:36.292099Z', 'updated_date': '2023-09-15T15:34:40.792068Z', 'issues': {'url': 'http://localhost:8080/api/issues?job_id=18', 'count': 0}, 'labels': {'url': 'http://localhost:8080/api/labels?job_id=18', 'count': 1}, 'type': 'annotation', 'organization': None}}}}}
ann_view.to_dict()
100% |█████████████████████| 1/1 [8.2ms elapsed, 0s remaining, 122.0 samples/s]
{'name': 'skeletons', 'version': '0.21.6', 'media_type': 'image', 'sample_fields': {'id': 'fiftyone.core.fields.ObjectIdField', 'filepath': 'fiftyone.core.fields.StringField', 'tags': 'fiftyone.core.fields.ListField(fiftyone.core.fields.StringField)', 'metadata': 'fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.metadata.ImageMetadata)', 'ground_truth': 'fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections)', 'uniqueness': 'fiftyone.core.fields.FloatField', 'predictions': 'fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections)'}, 'info': {}, 'skeletons': {'points': SON([('labels', ['left handleft shoulder', 'right shoulder', 'right hand', 'left eye', 'right eye', 'mouth']), ('edges', [[0, 1, 2, 3], [4, 5, 6]])])}, 'stages': [{'_cls': 'fiftyone.core.stages.MatchTags', 'kwargs': [['tags', ['annotate']], ['bool', True], ['all', False]]}], 'samples': [{'filepath': '/home/dan/fiftyone/quickstart/data/004126.jpg', 'tags': ['annotate'], 'metadata': {'_cls': 'ImageMetadata', 'size_bytes': 76725, 'mime_type': 'image/jpeg', 'width': 640, 'height': 367, 'num_channels': 3}, 'ground_truth': {'_cls': 'Detections', 'detections': [{'_id': {'$oid': '5f452486ef00e6374aad1f3b'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'person', 'bounding_box': [0.40128125, 0.10084468664850135, 0.4025625, 0.7338147138964578], 'area': 25741.941399999996, 'iscrowd': 0.0}, {'_id': {'$oid': '5f452486ef00e6374aad1f3c'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'skateboard', 'bounding_box': [0.42212500000000003, 0.6819891008174387, 0.369765625, 0.2647956403269755], 'area': 6746.244799999998, 'iscrowd': 0.0}]}, 'uniqueness': 0.5988490085951711, 'predictions': {'_cls': 'Detections', 'detections': [{'_id': {'$oid': '5f452c62ef00e6374aadad97'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'person', 'bounding_box': [0.4162792682647705, 0.10708199274962214, 0.38528170585632326, 0.7485176107214322], 'confidence': 0.9996997117996216}, {'_id': {'$oid': '5f452c62ef00e6374aadad98'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'skateboard', 'bounding_box': [0.42113075256347654, 0.7071953963193971, 0.35188612937927244, 0.2210996040531335], 'confidence': 0.9966714382171631}, {'_id': {'$oid': '5f452c62ef00e6374aadad99'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'skateboard', 'bounding_box': [0.42644128799438474, 0.7756693577571526, 0.25977129936218263, 0.1626938656175494], 'confidence': 0.26288551092147827}, {'_id': {'$oid': '5f452c62ef00e6374aadad9a'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'backpack', 'bounding_box': [0.4955601692199707, 0.2537781302220815, 0.1733004093170166, 0.1738174189014071], 'confidence': 0.09162653982639313}, {'_id': {'$oid': '5f452c62ef00e6374aadad9b'}, '_cls': 'Detection', 'attributes': {}, 'tags': [], 'label': 'skateboard', 'bounding_box': [0.5207001686096191, 0.697685137756514, 0.2611091613769531, 0.16240049772756301], 'confidence': 0.07061836868524551}]}}]}
ann_view.load_annotations("skeletons51", cleanup=True)
session.view = ann_view
Downloading labels from CVAT... Download complete Loading labels for field 'points'... 100% |█████████████████████| 1/1 [5.3ms elapsed, 0s remaining, 189.9 samples/s] Deleting tasks... 100% |█████████████████████| 1/1 [108.0ms elapsed, 0s remaining, 9.3 samples/s]