Skip to content

Commit 041da40

Browse files
committed
🚀 feat(label_widget, auto_labeling): Introduce GroupID filter and improve label filtering functionality (#686)
1 parent bdc63f8 commit 041da40

File tree

26 files changed

+17688
-17486
lines changed

26 files changed

+17688
-17486
lines changed

‎anylabeling/resources/resources.py

Lines changed: 16590 additions & 16589 deletions
Large diffs are not rendered by default.

‎anylabeling/resources/translations/en_US.ts

Lines changed: 422 additions & 411 deletions
Large diffs are not rendered by default.
21 Bytes
Binary file not shown.

‎anylabeling/resources/translations/zh_CN.ts

Lines changed: 423 additions & 407 deletions
Large diffs are not rendered by default.

‎anylabeling/services/auto_labeling/edge_sam.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def post_process(self, masks, image=None):
193193
shapes.append(shape)
194194
elif self.output_mode in ["rectangle", "rotation"]:
195195
shape = Shape(flags={})
196-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
196+
rectangle_box, rotation_box = get_bounding_boxes(
197+
approx_contours[0]
198+
)
197199
xmin, ymin, xmax, ymax = rectangle_box
198200
if self.output_mode == "rectangle":
199201
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -202,20 +204,21 @@ def post_process(self, masks, image=None):
202204
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
203205
else:
204206
for point in rotation_box:
205-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
207+
shape.add_point(
208+
QtCore.QPointF(int(point[0]), int(point[1]))
209+
)
206210
shape.shape_type = self.output_mode
207211
shape.closed = True
208212
shape.fill_color = "#000000"
209213
shape.line_color = "#000000"
210214
if self.clip_net is not None and self.classes:
211-
img = image[ymin: ymax, xmin: xmax]
215+
img = image[ymin:ymax, xmin:xmax]
212216
out = self.clip_net(img, self.classes)
213217
shape.cache_label = self.classes[int(np.argmax(out))]
214218
shape.label = "AUTOLABEL_OBJECT"
215219
shape.selected = False
216220
shapes.append(shape)
217221

218-
219222
return shapes
220223

221224
def predict_shapes(self, image, filename=None) -> AutoLabelingResult:

‎anylabeling/services/auto_labeling/efficientvit_sam.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ def post_process(self, masks):
349349
shapes.append(shape)
350350
elif self.output_mode in ["rectangle", "rotation"]:
351351
shape = Shape(flags={})
352-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
352+
rectangle_box, rotation_box = get_bounding_boxes(
353+
approx_contours[0]
354+
)
353355
xmin, ymin, xmax, ymax = rectangle_box
354356
if self.output_mode == "rectangle":
355357
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -358,20 +360,21 @@ def post_process(self, masks):
358360
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
359361
else:
360362
for point in rotation_box:
361-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
363+
shape.add_point(
364+
QtCore.QPointF(int(point[0]), int(point[1]))
365+
)
362366
shape.shape_type = self.output_mode
363367
shape.closed = True
364368
shape.fill_color = "#000000"
365369
shape.line_color = "#000000"
366370
if self.clip_net is not None and self.classes:
367-
img = image[ymin: ymax, xmin: xmax]
371+
img = image[ymin:ymax, xmin:xmax]
368372
out = self.clip_net(img, self.classes)
369373
shape.cache_label = self.classes[int(np.argmax(out))]
370374
shape.label = "AUTOLABEL_OBJECT"
371375
shape.selected = False
372376
shapes.append(shape)
373377

374-
375378
return shapes
376379

377380
def get_input_points(self):

‎anylabeling/services/auto_labeling/grounding_sam.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ def post_process(self, masks, label=None):
511511
shapes.append(shape)
512512
elif self.output_mode in ["rectangle", "rotation"]:
513513
shape = Shape(flags={})
514-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
514+
rectangle_box, rotation_box = get_bounding_boxes(
515+
approx_contours[0]
516+
)
515517
xmin, ymin, xmax, ymax = rectangle_box
516518
if self.output_mode == "rectangle":
517519
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -520,7 +522,9 @@ def post_process(self, masks, label=None):
520522
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
521523
else:
522524
for point in rotation_box:
523-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
525+
shape.add_point(
526+
QtCore.QPointF(int(point[0]), int(point[1]))
527+
)
524528
shape.shape_type = self.output_mode
525529
shape.closed = True
526530
shape.fill_color = "#000000"

‎anylabeling/services/auto_labeling/grounding_sam2.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ def post_process(self, masks, label=None):
317317
shapes.append(shape)
318318
elif self.output_mode in ["rectangle", "rotation"]:
319319
shape = Shape(flags={})
320-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
320+
rectangle_box, rotation_box = get_bounding_boxes(
321+
approx_contours[0]
322+
)
321323
xmin, ymin, xmax, ymax = rectangle_box
322324
if self.output_mode == "rectangle":
323325
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -326,7 +328,9 @@ def post_process(self, masks, label=None):
326328
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
327329
else:
328330
for point in rotation_box:
329-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
331+
shape.add_point(
332+
QtCore.QPointF(int(point[0]), int(point[1]))
333+
)
330334
shape.shape_type = self.output_mode
331335
shape.closed = True
332336
shape.fill_color = "#000000"

‎anylabeling/services/auto_labeling/open_vision.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ def post_process(self, masks, label=None):
271271
shapes.append(shape)
272272
elif self.output_mode in ["rectangle", "rotation"]:
273273
shape = Shape(flags={})
274-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
274+
rectangle_box, rotation_box = get_bounding_boxes(
275+
approx_contours[0]
276+
)
275277
xmin, ymin, xmax, ymax = rectangle_box
276278
if self.output_mode == "rectangle":
277279
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -280,7 +282,9 @@ def post_process(self, masks, label=None):
280282
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
281283
else:
282284
for point in rotation_box:
283-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
285+
shape.add_point(
286+
QtCore.QPointF(int(point[0]), int(point[1]))
287+
)
284288
shape.shape_type = self.output_mode
285289
shape.closed = True
286290
shape.fill_color = "#000000"

‎anylabeling/services/auto_labeling/sam_hq.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ def post_process(self, masks, image=None):
398398
shapes.append(shape)
399399
elif self.output_mode in ["rectangle", "rotation"]:
400400
shape = Shape(flags={})
401-
rectangle_box, rotation_box = get_bounding_boxes(approx_contours[0])
401+
rectangle_box, rotation_box = get_bounding_boxes(
402+
approx_contours[0]
403+
)
402404
xmin, ymin, xmax, ymax = rectangle_box
403405
if self.output_mode == "rectangle":
404406
shape.add_point(QtCore.QPointF(int(xmin), int(ymin)))
@@ -407,13 +409,15 @@ def post_process(self, masks, image=None):
407409
shape.add_point(QtCore.QPointF(int(xmin), int(ymax)))
408410
else:
409411
for point in rotation_box:
410-
shape.add_point(QtCore.QPointF(int(point[0]), int(point[1])))
412+
shape.add_point(
413+
QtCore.QPointF(int(point[0]), int(point[1]))
414+
)
411415
shape.shape_type = self.output_mode
412416
shape.closed = True
413417
shape.fill_color = "#000000"
414418
shape.line_color = "#000000"
415419
if self.clip_net is not None and self.classes:
416-
img = image[ymin: ymax, xmin: xmax]
420+
img = image[ymin:ymax, xmin:xmax]
417421
out = self.clip_net(img, self.classes)
418422
shape.cache_label = self.classes[int(np.argmax(out))]
419423
shape.label = "AUTOLABEL_OBJECT"

0 commit comments

Comments
 (0)