-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAM for dynamic aspect ration images #760
Comments
As-is, there's not really a lot of alternatives to handling non-square images, other than the existing padding that the SAM model uses. I have a modified copy of the model that can directly process non-square images and at sizes higher than 1024 (or lower) and the model seems to work just fine. It's currently a messy w.i.p., but if I remember, I'll post a link to it here once I've uploaded it.
The automatic mask generator just runs the normal 'single point prompt' version of SAM repeatedly for every point on your point grid (and then does some work to clean-up/merge all of the separate mask results). So adjusting the point grid shouldn't require any changes to the prompt-encoder weights. If you're running the automatic mask generator script directly on your computer (i.e. not through a notebook/collab) then you can visualize the points on your image, by adding a few lines of code. In the segment_anything/automatic_mask_generator.py script, after line 240, you can add: debug_img = cv2.cvtColor(cropped_im, cv2.COLOR_RGB2BGR)
for xy in points_for_image:
pt_xy = xy.astype(np.int32).tolist()
cv2.circle(debug_img, pt_xy, 2, (255,0,255), -1)
cv2.imshow("POINTS", debug_img)
cv2.waitKey(0)
cv2.destroyWindow("POINTS") You'll also need to add Another thing worth trying is the |
Hi @heyoeyo , I'm trying to fine-tune SAM for panorama images of the indoor scenes, which are all of different rations, but as they are panoramas their width is always longer then height.
To provide a better context, here is the example of the panorama image I use as input and the masks output I got after fine-tuning. The masks are targeting the objects of interest but they are clearly over-segmented. I'm trying to understand if it's because of the image pre-processing or changes with the point grid.
Thank you!
The text was updated successfully, but these errors were encountered: