You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
What I Did
Trying to segment using box prompt
( boxes defined without CRS , i want to use image coordinates )
based on this box prompt example: , :https://samgeo.gishub.org/examples/box_prompts/
trying to run without CRS
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in _call_impl(self, *args, **kwargs)
1499 or _global_backward_pre_hooks or _global_backward_hooks
1500 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501 return forward_call(*args, **kwargs)
1502 # Do not call functions when jit is used
1503 full_backward_hooks, non_full_backward_hooks = [], []
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in forward(self, points, boxes, masks)
156 sparse_embeddings = torch.cat([sparse_embeddings, point_embeddings], dim=1)
157 if boxes is not None:
--> 158 box_embeddings = self._embed_boxes(boxes)
159 sparse_embeddings = torch.cat([sparse_embeddings, box_embeddings], dim=1)
160
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in _embed_boxes(self, boxes)
95 boxes = boxes + 0.5 # Shift to center of pixel
96 coords = boxes.reshape(-1, 2, 2)
---> 97 corner_embedding = self.pe_layer.forward_with_coords(coords, self.input_image_size)
98 corner_embedding[:, 0, :] += self.point_embeddings[2].weight
99 corner_embedding[:, 1, :] += self.point_embeddings[3].weight
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in forward_with_coords(self, coords_input, image_size)
209 ) -> torch.Tensor:
210 """Positionally encode points that are not normalized to [0,1]."""
--> 211 coords = coords_input.clone()
212 coords[:, :, 0] = coords[:, :, 0] / image_size[1]
213 coords[:, :, 1] = coords[:, :, 1] / image_size[0]
AttributeError: 'numpy.ndarray' object has no attribute 'clone'
The text was updated successfully, but these errors were encountered:
Environment Information
Description
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
What I Did
Trying to segment using box prompt
( boxes defined without CRS , i want to use image coordinates )
based on this box prompt example: , :https://samgeo.gishub.org/examples/box_prompts/
trying to run without CRS
Error:
AttributeError: 'numpy.ndarray' object has no attribute 'clone'
traceback :
/usr/local/lib/python3.10/dist-packages/samgeo/samgeo.py in predict(self, point_coords, point_labels, boxes, point_crs, mask_input, multimask_output, return_logits, output, index, mask_multiplier, dtype, return_results, **kwargs)
583 )
584 else:
--> 585 masks, scores, logits = predictor.predict_torch(
586 point_coords=point_coords,
587 point_labels=point_coords,
/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py in decorate_context(*args, **kwargs)
113 def decorate_context(*args, **kwargs):
114 with ctx_factory():
--> 115 return func(*args, **kwargs)
116
117 return decorate_context
/usr/local/lib/python3.10/dist-packages/segment_anything/predictor.py in predict_torch(self, point_coords, point_labels, boxes, mask_input, multimask_output, return_logits)
220
221 # Embed prompts
--> 222 sparse_embeddings, dense_embeddings = self.model.prompt_encoder(
223 points=points,
224 boxes=boxes,
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in _call_impl(self, *args, **kwargs)
1499 or _global_backward_pre_hooks or _global_backward_hooks
1500 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501 return forward_call(*args, **kwargs)
1502 # Do not call functions when jit is used
1503 full_backward_hooks, non_full_backward_hooks = [], []
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in forward(self, points, boxes, masks)
156 sparse_embeddings = torch.cat([sparse_embeddings, point_embeddings], dim=1)
157 if boxes is not None:
--> 158 box_embeddings = self._embed_boxes(boxes)
159 sparse_embeddings = torch.cat([sparse_embeddings, box_embeddings], dim=1)
160
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in _embed_boxes(self, boxes)
95 boxes = boxes + 0.5 # Shift to center of pixel
96 coords = boxes.reshape(-1, 2, 2)
---> 97 corner_embedding = self.pe_layer.forward_with_coords(coords, self.input_image_size)
98 corner_embedding[:, 0, :] += self.point_embeddings[2].weight
99 corner_embedding[:, 1, :] += self.point_embeddings[3].weight
/usr/local/lib/python3.10/dist-packages/segment_anything/modeling/prompt_encoder.py in forward_with_coords(self, coords_input, image_size)
209 ) -> torch.Tensor:
210 """Positionally encode points that are not normalized to [0,1]."""
--> 211 coords = coords_input.clone()
212 coords[:, :, 0] = coords[:, :, 0] / image_size[1]
213 coords[:, :, 1] = coords[:, :, 1] / image_size[0]
AttributeError: 'numpy.ndarray' object has no attribute 'clone'
The text was updated successfully, but these errors were encountered: