未验证 提交 cc4b3f31 编写于 作者: A Anastasia Yasakova 提交者: GitHub

Fix incorrect attribute import in tracks (#3229)

* add fixes

* remove comments

* fix return value in filter_track_shapes

* update changelog
上级 573bdbe3
......@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Project page requests took a long time and did many DB queries (<https://github.com/openvinotoolkit/cvat/pull/3223>)
- Fixed Python 3.6 support (<https://github.com/openvinotoolkit/cvat/pull/3258>)
- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)
### Security
......
......@@ -86,9 +86,6 @@ class AnnotationIR:
drop_count += 1
else:
break
# Need to leave the last shape if all shapes are outside
if drop_count == len(shapes):
drop_count -= 1
return shapes[drop_count:]
......@@ -103,8 +100,12 @@ class AnnotationIR:
if scoped_shapes:
if not scoped_shapes[0]['keyframe']:
segment_shapes.insert(0, scoped_shapes[0])
if not scoped_shapes[-1]['keyframe']:
if not scoped_shapes[-1]['keyframe'] and \
scoped_shapes[-1]['outside']:
segment_shapes.append(scoped_shapes[-1])
elif stop + 1 < len(interpolated_shapes) and \
interpolated_shapes[stop + 1]['outside']:
segment_shapes.append(interpolated_shapes[stop + 1])
# Should delete 'interpolation_shapes' and 'keyframe' keys because
# Track and TrackedShape models don't expect these fields
......@@ -113,7 +114,8 @@ class AnnotationIR:
shape.pop('keyframe', None)
track['shapes'] = segment_shapes
track['frame'] = track['shapes'][0]['frame']
if 0 < len(segment_shapes):
track['frame'] = track['shapes'][0]['frame']
return track
def slice(self, start, stop):
......@@ -123,8 +125,13 @@ class AnnotationIR:
for t in self.tags if self._is_shape_inside(t, start, stop)]
splitted_data.shapes = [deepcopy(s)
for s in self.shapes if self._is_shape_inside(s, start, stop)]
splitted_data.tracks = [self._slice_track(t, start, stop)
for t in self.tracks if self._is_track_inside(t, start, stop)]
splitted_tracks = []
for t in self.tracks:
if self._is_track_inside(t, start, stop):
track = self._slice_track(t, start, stop)
if 0 < len(track['shapes']):
splitted_tracks.append(track)
splitted_data.tracks = splitted_tracks
return splitted_data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册