Skip to content

Commit

Permalink
Fix bounding box sorting from dict to list
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Nov 1, 2023
1 parent 0f9f9d1 commit ef5aff5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions micro_sam/training/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import List, Optional, Union

import numpy as np
import torch

from ..prompt_generators import PointAndBoxPromptGenerator
from ..util import get_centers_and_bounding_boxes, get_sam_model, segmentation_to_one_hot, _get_device
Expand Down Expand Up @@ -86,8 +85,8 @@ def _get_prompt_lists(self, gt, n_samples, prompt_generator):
sampled_cell_ids = np.random.choice(cell_ids, size=min(n_samples, len(cell_ids)), replace=False)
sampled_cell_ids = np.sort(sampled_cell_ids)

# only keep the bounding boxes for sampled cell ids
bbox_coordinates = [bbox_coordinates[sampled_id] for sampled_id in sampled_cell_ids]
# only keep the bounding boxes for sampled cell ids
bbox_coordinates = [bbox_coordinates[sampled_id] for sampled_id in sampled_cell_ids]

# convert the gt to the one-hot-encoded masks for the sampled cell ids
object_masks = segmentation_to_one_hot(gt, None if n_samples is None else sampled_cell_ids)
Expand Down

0 comments on commit ef5aff5

Please sign in to comment.