bugfix
This commit is contained in:
@@ -152,7 +152,7 @@ class Florence2toCoordinates:
|
||||
for idx in indexes:
|
||||
if 0 <= idx < len(data[0]):
|
||||
for i in range(len(data)):
|
||||
bbox = data[i][idx]
|
||||
bbox = data[i][idx] if i < len(data) else data[0].get("bboxes", [])[idx]
|
||||
min_x, min_y, max_x, max_y = bbox
|
||||
center_x = int((min_x + max_x) / 2)
|
||||
center_y = int((min_y + max_y) / 2)
|
||||
@@ -161,7 +161,7 @@ class Florence2toCoordinates:
|
||||
else:
|
||||
for idx in indexes:
|
||||
if 0 <= idx < len(data[0]):
|
||||
bbox = data[0][idx]
|
||||
bbox = data[0].get("bboxes", [])[idx] if isinstance(data[0], dict) else data[0][idx]
|
||||
min_x, min_y, max_x, max_y = bbox
|
||||
center_x = int((min_x + max_x) / 2)
|
||||
center_y = int((min_y + max_y) / 2)
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
pyyaml
|
||||
numpy<=1.26.4
|
||||
iopath
|
||||
|
||||
@@ -284,7 +284,9 @@ class SAM2AutomaticMaskGenerator:
|
||||
orig_h, orig_w = orig_size
|
||||
|
||||
# Run model on this batch
|
||||
points = torch.as_tensor(points, device=self.predictor.device)
|
||||
points = torch.as_tensor(
|
||||
points, dtype=torch.float32, device=self.predictor.device
|
||||
)
|
||||
in_points = self.predictor._transforms.transform_coords(
|
||||
points, normalize=normalize, orig_hw=im_size
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user