Skip to content
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

Buildings Instance Segmentation Support #6

Open
sharoseali opened this issue Nov 11, 2024 · 7 comments
Open

Buildings Instance Segmentation Support #6

sharoseali opened this issue Nov 11, 2024 · 7 comments

Comments

@sharoseali
Copy link

sharoseali commented Nov 11, 2024

HI @AlbughdadiM I have opened another issue as the topic is different.

I've opened another issue since the topics are different.

Previously, I worked on SAM Geo, where we can segment buildings. In that context, SAM can easily detect buildings without requiring explicit foreground inputs. However, in this case, the output is quite different. After applying Zoom and drawing the ROI, the result is a single polygon. I also tried using the SAM L and SAM H models.

image

Do I need to adjust any specific settings in the code? Also tiff imagery appearance is quite bright as compared to QGIS appearance. like this :

image

@AlbughdadiM
Copy link
Owner

Hi @sharoseali
From what I can see, it looks like you defined a bounding box for the ROI with support points inside it. As mentioned in the README file, points are not supported as standalone prompts, so the points you added are considered to belong for the same object, which explains the rectangular mask. Try either automatic segmentation as explained in the repo, or define a bounding box for each building inside the ROI. Then if needed, you can add prompt points inside the bounding box of each object defining the foreground and background.
Regarding the image, could you provide more info on the source of this image?
Make sure that the image is scaled between 0 and 255 to be correctly overlayed on the map. Also, this is required by SAM.

@sharoseali
Copy link
Author

sharoseali commented Nov 12, 2024

hi @AlbughdadiM Well I have tried to apply automatic segmentation again carefully. But getting the same results. It draws one big polygon on the area. Also, I tried Foreground and background pixels but got the same output. Here is the tiff file link.

For image scaling, I don't think so we have any implementation code that extracts tile from ROI and rescales it.

@AlbughdadiM
Copy link
Owner

hi @sharoseali
There are two concerns regarding the image:

  • The fourth band will be probably treated as alpha band. So this should be removed.
  • The size of the image is very large and it requires a lot of resources.

I cropped part of the image and performed automatic and prompt segmentation as you can see in the following screenshots

Screenshot 2024-11-12 at 12 55 06 Screenshot 2024-11-12 at 12 56 09 Screenshot 2024-11-12 at 12 56 45

@sharoseali
Copy link
Author

I see did you update the code also in sam utils? OR I have used dashboard wrongly ?

@AlbughdadiM
Copy link
Owner

only minor changes to handle data types when creating the PNG but this doesn't affect the segmentation as the GeoTiff image is directly used for that

@sharoseali
Copy link
Author

  • The fourth band will be probably treated as alpha band. So this should be removed.

  • The size of the image is very large and it requires a lot of resources

I have checked same Tiff image using Sam Geo library. It has given very good results without cropping or changing tiff to PNG. I also created GeoJSON and map on QGIS. Its working correctly for the whole image. Normally it loose accuracy if we give very huge tile to it.

May be need some more operations to handle all size imagery in your implementation. Will try to compare the codes.

@AlbughdadiM
Copy link
Owner

  • The fourth band will be probably treated as alpha band. So this should be removed.
  • The size of the image is very large and it requires a lot of resources

I have checked same Tiff image using Sam Geo library. It has given very good results without cropping or changing tiff to PNG. I also created GeoJSON and map on QGIS. Its working correctly for the whole image. Normally it loose accuracy if we give very huge tile to it.

May be need some more operations to handle all size imagery in your implementation. Will try to compare the codes.

The PNG is only to overlay on the map but not used for segmentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants