Fix point interpolation (#1344)

* Extend formats tests with different track types

* Add unordered list comparison

* Skip empty list comparison

* fix

* fix

* Reproduce problem

* Fix point interpolation for single point

* undo rest api refactor
main
zhiltsov-max 6 years ago committed by GitHub
parent 1feeef6e73
commit 66c6e7e919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -293,7 +293,10 @@ class TrackManager(ObjectManager):
@staticmethod
def normalize_shape(shape):
points = np.asarray(shape["points"]).reshape(-1, 2)
points = list(shape["points"])
if len(points) == 2:
points.extend(points) # duplicate points for single point case
points = np.asarray(points).reshape(-1, 2)
broken_line = geometry.LineString(points)
points = []
for off in range(0, 100, 1):

@ -0,0 +1,39 @@
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
from cvat.apps.engine.data_manager import TrackManager
from unittest import TestCase
class TrackManagerTest(TestCase):
def test_single_point_interpolation(self):
track = {
"frame": 0,
"label_id": 0,
"group": None,
"attributes": [],
"shapes": [
{
"frame": 0,
"points": [1.0, 2.0],
"type": "points",
"occluded": False,
"outside": False,
"attributes": []
},
{
"frame": 2,
"attributes": [],
"points": [3.0, 4.0, 5.0, 6.0],
"type": "points",
"occluded": False,
"outside": True
},
]
}
interpolated = TrackManager.get_interpolated_shapes(track, 0, 2)
self.assertEqual(len(interpolated), 3)
Loading…
Cancel
Save