I am using the library segment-geospatial to try and segment some plants in a raster image I have.
image = '/content/drive/MyDrive/myimage.tiff'
sam = SamGeo(
model_type="vit_h",
automatic=False,
sam_kwargs=None,
)
sam.set_image(image)
boxes = [
[-51.2546, -22.1771, -51.2541, -22.1767],
[-51.2538, -22.1764, -51.2535, -22.1761],
]
sam.predict(boxes=boxes, point_crs="EPSG:4326", output="mask.tif", dtype="uint8")
When I run sam.predict() I get the following error:
No valid pixel coordinates found.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-72-a3b6cdcab301> in <cell line: 0>()
----> 1 sam.predict(boxes=boxes, point_crs="EPSG:4326", output="mask.tif", dtype="uint8")
/usr/local/lib/python3.11/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)
615 coords = bbox_to_xy(self.source, boxes, point_crs)
616 input_boxes = np.array(coords)
--> 617 if isinstance(coords[0], int):
618 input_boxes = input_boxes[None, :]
619 else:
TypeError: 'NoneType' object is not subscriptable
I have already checked that the raster image crs format is correct and I already tried this code with the example they provide in the documentation and it worked fine, but when I try it with my raster it doesn't work. /