@@ -65,9 +65,10 @@ def from_common(cls, point: Point,
6565class NDFramePoint (VideoSupported ):
6666 point : _Point
6767
68- def to_common (self , name : str ,
69- feature_schema_id : Cuid ) -> VideoObjectAnnotation :
68+ def to_common (self , name : str , feature_schema_id : Cuid ,
69+ segment_index : int ) -> VideoObjectAnnotation :
7070 return VideoObjectAnnotation (frame = self .frame ,
71+ segment_index = segment_index ,
7172 keyframe = True ,
7273 name = name ,
7374 feature_schema_id = feature_schema_id ,
@@ -104,10 +105,11 @@ def from_common(cls, line: Line,
104105class NDFrameLine (VideoSupported ):
105106 line : List [_Point ]
106107
107- def to_common (self , name : str ,
108- feature_schema_id : Cuid ) -> VideoObjectAnnotation :
108+ def to_common (self , name : str , feature_schema_id : Cuid ,
109+ segment_index : int ) -> VideoObjectAnnotation :
109110 return VideoObjectAnnotation (
110111 frame = self .frame ,
112+ segment_index = segment_index ,
111113 keyframe = True ,
112114 name = name ,
113115 feature_schema_id = feature_schema_id ,
@@ -171,10 +173,11 @@ def from_common(cls, rectangle: Rectangle,
171173class NDFrameRectangle (VideoSupported ):
172174 bbox : Bbox
173175
174- def to_common (self , name : str ,
175- feature_schema_id : Cuid ) -> VideoObjectAnnotation :
176+ def to_common (self , name : str , feature_schema_id : Cuid ,
177+ segment_index : int ) -> VideoObjectAnnotation :
176178 return VideoObjectAnnotation (
177179 frame = self .frame ,
180+ segment_index = segment_index ,
178181 keyframe = True ,
179182 name = name ,
180183 feature_schema_id = feature_schema_id ,
@@ -211,11 +214,13 @@ def segment_with_uuid(keyframe: Union[NDFrameRectangle, NDFramePoint,
211214 keyframe .extra = {'uuid' : uuid }
212215 return keyframe
213216
214- def to_common (self , name : str , feature_schema_id : Cuid , uuid : str ):
217+ def to_common (self , name : str , feature_schema_id : Cuid , uuid : str ,
218+ segment_index : int ):
215219 return [
216220 self .segment_with_uuid (
217221 keyframe .to_common (name = name ,
218- feature_schema_id = feature_schema_id ), uuid )
222+ feature_schema_id = feature_schema_id ,
223+ segment_index = segment_index ), uuid )
219224 for keyframe in self .keyframes
220225 ]
221226
@@ -235,11 +240,12 @@ class NDSegments(NDBaseObject):
235240
236241 def to_common (self , name : str , feature_schema_id : Cuid ):
237242 result = []
238- for segment in self .segments :
243+ for idx , segment in enumerate ( self .segments ) :
239244 result .extend (
240245 NDSegment .to_common (segment ,
241246 name = name ,
242247 feature_schema_id = feature_schema_id ,
248+ segment_index = idx ,
243249 uuid = self .uuid ))
244250 return result
245251
0 commit comments