Skip to content

Commit f674f53

Browse files
cwhite911Corey White
and
Corey White
authored
text_sam: Fixed issue when passing PIL Image as input to SamGeo2 (#370)
Co-authored-by: Corey White <ctwhite48@gmail.com>
1 parent 94cfeab commit f674f53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

samgeo/text_sam.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ def predict_sam(self, image, boxes):
229229
)
230230
return masks.cpu()
231231
elif self._sam_version == 2:
232-
self.sam.set_image(self.source)
232+
233+
if isinstance(self.source, str):
234+
self.sam.set_image(self.source)
235+
# If no source is set provide PIL image
236+
if self.source is None:
237+
self.sam.set_image(image)
233238
self.sam.boxes = boxes.numpy().tolist()
234239
masks, _, _ = self.sam.predict(
235240
boxes=boxes.numpy().tolist(),

0 commit comments

Comments
 (0)