File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -168,14 +168,23 @@ def _labels(self) -> "set[str]":
168168 return {b .label for b in self .all_boxes }
169169
170170 def filter (self , predicate : Callable [[Annotation ], bool ]) -> "AnnotationSet" :
171+ """
172+ Filter the dataset by a predicate function that takes an `Annotation` and returns True if the annotation should be kept.
173+ """
171174 return AnnotationSet (annotations = [a for a in self if predicate (a )])
172175
173176 def map (self , func : Callable [[Annotation ], Annotation ]) -> "AnnotationSet" :
177+ """
178+ Transform the annotations of the annotation set by applying a function to each annotation.
179+ """
174180 return AnnotationSet (annotations = [func (a ) for a in self ])
175181
176182 def filter_labels (
177183 self , labels : Iterable [str ], keep_empty : bool = False
178184 ) -> "AnnotationSet" :
185+ """
186+ Filter the annotations by keeping only the bounding boxes with labels in the provided iterable.
187+ """
179188 labels_to_keep = set (labels )
180189
181190 def filter_labels (annotation : "Annotation" ) -> "Annotation" :
You can’t perform that action at this time.
0 commit comments