Tobias Cornille commited on
Commit
da3ec5c
1 Parent(s): 17d77a8

Fix annotation names

Browse files
Files changed (1) hide show
  1. app.py +1 -7
app.py CHANGED
@@ -365,7 +365,6 @@ def generate_panoptic_mask(
365
  thing_masks = sam_masks_from_dino_boxes(
366
  sam_predictor, image_array, thing_boxes, device
367
  )
368
- detected_stuff_category_names = []
369
  if len(stuff_category_names) > 0:
370
  # get rough segmentation masks for "stuff" categories using CLIPSeg
371
  clipseg_preds, clipseg_semantic_inds = clipseg_segmentation(
@@ -408,11 +407,6 @@ def generate_panoptic_mask(
408
  sam_semantic_inds = preds_to_semantic_inds(
409
  sam_preds, segmentation_background_threshold
410
  )
411
- detected_stuff_category_names = [
412
- category_name
413
- for i, category_name in enumerate(category_names)
414
- if i + 1 in np.unique(sam_semantic_inds.numpy())
415
- ]
416
 
417
  # combine the thing inds and the stuff inds into panoptic inds
418
  panoptic_inds = (
@@ -432,7 +426,7 @@ def generate_panoptic_mask(
432
  .astype(int)
433
  )
434
  panoptic_names = (
435
- ["unlabeled"] + detected_stuff_category_names + detected_thing_category_names
436
  )
437
  subsection_label_pairs = [
438
  (panoptic_bool_masks[i], panoptic_name)
 
365
  thing_masks = sam_masks_from_dino_boxes(
366
  sam_predictor, image_array, thing_boxes, device
367
  )
 
368
  if len(stuff_category_names) > 0:
369
  # get rough segmentation masks for "stuff" categories using CLIPSeg
370
  clipseg_preds, clipseg_semantic_inds = clipseg_segmentation(
 
407
  sam_semantic_inds = preds_to_semantic_inds(
408
  sam_preds, segmentation_background_threshold
409
  )
 
 
 
 
 
410
 
411
  # combine the thing inds and the stuff inds into panoptic inds
412
  panoptic_inds = (
 
426
  .astype(int)
427
  )
428
  panoptic_names = (
429
+ ["unlabeled"] + stuff_category_names + detected_thing_category_names
430
  )
431
  subsection_label_pairs = [
432
  (panoptic_bool_masks[i], panoptic_name)