Skip to content
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

fixing problems with skeleton tracks with missing points #8377

Merged
merged 13 commits into from
Sep 5, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Export crashed on skeleton track with missing shapes
(<https://github.com/cvat-ai/cvat/pull/8377>)
2 changes: 1 addition & 1 deletion cvat-core/src/annotations-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ export class SkeletonTrack extends Track {
parentID: this.clientID,
readOnlyFields: ['group', 'zOrder', 'source', 'rotation'],
});
}).sort((a: Annotation, b: Annotation) => a.label.id - b.label.id);
}).filter(Boolean).sort((a: Annotation, b: Annotation) => a.label.id - b.label.id);
}

public updateFromServerResponse(body: SerializedTrack): void {
Expand Down
4 changes: 3 additions & 1 deletion cvat/apps/dataset_manager/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def has_overlap(a, b):

prev_shape = shape

if not prev_shape['outside'] and prev_shape['frame'] <= stop:
if prev_shape is not None and not prev_shape['outside'] and prev_shape['frame'] <= stop:
return True

return False
Expand Down Expand Up @@ -552,6 +552,8 @@ def _calc_objects_similarity(obj0, obj1, start_frame, overlap, dimension):
return 0

def _modify_unmatched_object(self, obj, end_frame):
if not obj["shapes"]:
return
shape = obj["shapes"][-1]
if not shape["outside"]:
shape = deepcopy(shape)
Expand Down
159 changes: 159 additions & 0 deletions cvat/apps/dataset_manager/tests/assets/annotations.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,165 @@
],
"tracks": []
},
"many jobs skeleton tracks with missing shapes": {
"version": 0,
"tags": [],
"shapes": [],
"tracks": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [
{
"type": "skeleton",
"occluded": false,
"outside": false,
"z_order": 0,
"rotation": 0,
"points": [],
"frame": 10,
"attributes": []
}
],
"attributes": [],
"elements": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [],
"attributes": [],
"label_id": null
},
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [],
"attributes": [],
"label_id": null
}
],
"label_id": null
}
]
},
"many jobs skeleton tracks with missing shapes - some points present": {
"version": 0,
"tags": [],
"shapes": [],
"tracks": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [
{
"type": "skeleton",
"occluded": false,
"outside": false,
"z_order": 0,
"rotation": 0,
"points": [],
"frame": 10,
"attributes": []
}
],
"attributes": [],
"elements": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [
{
"type": "points",
"occluded": false,
"outside": false,
"z_order": 0,
"rotation": 0,
"points": [
613.99,
326.54
],
"frame": 10,
"attributes": []
},
{
"type": "points",
"occluded": false,
"outside": true,
"z_order": 0,
"rotation": 0,
"points": [
613.99,
326.54
],
"frame": 12,
"attributes": []
}
],
"attributes": [],
"label_id": null
},
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [],
"attributes": [],
"label_id": null
}
],
"label_id": null
}
]
},
"many jobs skeleton tracks with missing shapes - skeleton is outside": {
"version": 0,
"tags": [],
"shapes": [],
"tracks": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [
{
"type": "skeleton",
"occluded": false,
"outside": true,
"z_order": 0,
"rotation": 0,
"points": [],
"frame": 10,
"attributes": []
}
],
"attributes": [],
"elements": [
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [],
"attributes": [],
"label_id": null
},
{
"frame": 10,
"group": 0,
"source": "file",
"shapes": [],
"attributes": [],
"label_id": null
}
],
"label_id": null
}
]
},
"ICDAR Localization 1.0": {
"version": 0,
"tags": [],
Expand Down
41 changes: 41 additions & 0 deletions cvat/apps/dataset_manager/tests/assets/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,47 @@
}
]
},
"many jobs skeleton": {
"name": "many jobs",
"overlap": 5,
"segment_size": 10,
"labels": [
{
"name": "skeleton",
"color": "#2080c0",
"type": "skeleton",
"attributes": [
{
"name": "attr",
"mutable": false,
"input_type": "select",
"values": ["1", "2", "3"]
}
],
"sublabels": [
{
"name": "1",
"color": "#d12345",
"attributes": [],
"type": "points"
},
{
"name": "2",
"color": "#350dea",
"attributes": [],
"type": "points"
},
{
"name": "3",
"color": "#479ffe",
"attributes": [],
"type": "points"
}
],
"svg": "<line x1=\"38.92810821533203\" y1=\"53.31378173828125\" x2=\"80.23341369628906\" y2=\"18.36313819885254\" stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"30.399484634399414\" y1=\"32.74474334716797\" x2=\"38.92810821533203\" y2=\"53.31378173828125\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"30.399484634399414\" cy=\"32.74474334716797\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-name=\"1\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"38.92810821533203\" cy=\"53.31378173828125\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-name=\"2\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"80.23341369628906\" cy=\"18.36313819885254\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-name=\"3\"></circle>"
}
]
},
"change overlap and segment size": {
"name": "change overlap and segment size",
"overlap": 3,
Expand Down
Loading
Loading