-
Notifications
You must be signed in to change notification settings - Fork 162
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
i.sam2: SamGeo2 model #1244
base: grass8
Are you sure you want to change the base?
i.sam2: SamGeo2 model #1244
Conversation
Cool, need to try this out. |
Co-authored-by: Markus Neteler <[email protected]>
Co-authored-by: Markus Neteler <[email protected]>
I've submitted PR: opengeos/segment-geospatial#370 to fix an upstream issue in the segment-geospatial library. |
Would you mind to add "trees.png" in a higher resolution (perhaps as JPG), at time it is only 640 x 480. The code for a clickable image figure is found at Please also change the name to |
So cool, @cwhite911! Would you mind adding the requirements and how to install it within the manual page as in here, for example. It would be more visible for users and clear, too. |
I tried to run this on Windows 10, GRAS GIS 8.4, installed via OSGeo4W. I am getting the following errors:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cwhite911 Please see feedback in code
@veroandreo I've just updated the docs with the full list of dependencies in the requirements section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor typos fixed
Co-authored-by: Veronica Andreo <[email protected]>
Co-authored-by: Veronica Andreo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor things :)
|
||
def normalize_rgb_array(rgb_array): | ||
""" | ||
Normalize an RGB array to the range [0, 255]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize an RGB array to the range [0, 255]. | |
Normalizes an RGB array to the range [0, 255]. |
torch.cuda.empty_cache() | ||
def run_samgeo_segmentation(temp_input_path, temp_output_path, model_path, device): | ||
""" | ||
Run SAMGeo segmentation on an input image and save the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run SAMGeo segmentation on an input image and save the output. | |
Runs SAMGeo segmentation on an input image and saves the output. |
input_np_array (list of numpy.ndarray): A list of numpy arrays representing the input raster bands. | ||
output_raster (str): The name of the output raster map to be created in GRASS GIS. | ||
|
||
Raises: | ||
ValueError: If the input array is empty or if the masks do not have the same shape. | ||
|
||
This function merges multiple raster bands into a single raster, where each band is assigned a unique value. | ||
The merged raster is then written to a GRASS GIS raster map. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first time you use raster "bands". Would it be equivalent to use raster maps or segmented masks?
A new module
i.sam2
for segmenting orthoimagery using text prompts with the SAMGeo model (Segment Anything Model Geospatial).i.sam2 group=rgb_255 output=tree_mask text_prompt="trees"