Skip to content

Commit 0a0efaf

Browse files
VahagnTKAVaghinakDev
authored andcommitted
removing tests for duration, no interpolation for polygon and polyline
1 parent c18c5e4 commit 0a0efaf

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/superannotate/lib/core/video_convertor.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Annotation(BaseModel):
1818
classId: Optional[int]
1919
x: Optional[Any]
2020
y: Optional[Any]
21-
points: Optional[Dict]
21+
points: Any
2222
attributes: Optional[List[Any]] = []
2323
keyframe: bool = False
2424

@@ -30,7 +30,6 @@ class FrameAnnotation(BaseModel):
3030

3131
class VideoFrameGenerator:
3232
def __init__(self, annotation_data: dict, fps: int):
33-
self.validate_annotations(annotation_data)
3433
self.id_generator = iter(itertools.count(0))
3534
self._annotation_data = annotation_data
3635
self.duration = annotation_data["metadata"]["duration"] / (1000 * 1000)
@@ -42,12 +41,6 @@ def __init__(self, annotation_data: dict, fps: int):
4241
self._mapping = {}
4342
self._process()
4443

45-
@staticmethod
46-
def validate_annotations(annotation_data: dict):
47-
duration = annotation_data["metadata"].get("duration")
48-
if duration is None:
49-
raise AppException("Video not annotated yet")
50-
5144
def get_frame(self, frame_no: int):
5245
try:
5346
return self.annotations[frame_no]
@@ -81,10 +74,9 @@ def _interpolate(
8174
"x": round(data["x"] + steps["x"] * idx, 2),
8275
"y": round(data["y"] + steps["y"] * idx, 2),
8376
}
84-
elif annotation_type in (AnnotationTypes.POLYGON, AnnotationTypes.POLYLINE):
85-
tmp_data["points"] = [
86-
point + steps[idx] * 2 for idx, point in enumerate(data["points"])
87-
]
77+
else:
78+
tmp_data["points"] = data["points"]
79+
8880
annotations[frame_idx] = Annotation(
8981
instanceId=instance_id,
9082
type=annotation_type,

0 commit comments

Comments
 (0)