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

Unable to merge large rasters when using text prompt in batch segmentation #181

Open
Ankit-Vohra opened this issue Aug 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Ankit-Vohra
Copy link

I'm trying to run batch segmentation on a orthomosaic of 4gb, what should be the free storage required in my system if I have to merge all the tiles and build one single raster out of all the masks.
Settings which I have used:

  1. Tile size: 1000*1000
  2. Overlap: 100pixels
  3. Total tiles: 1568

My code is executing fine but it throws error that disk is full while merging all the masks although I have over 200 gb storage available in my disk.

@Ankit-Vohra Ankit-Vohra added the bug Something isn't working label Aug 28, 2023
@giswqs
Copy link
Member

giswqs commented Aug 28, 2023

Please provide the source code that you used.

@Ankit-Vohra
Copy link
Author


import leafmap
from samgeo import tms_to_geotiff, split_raster
from samgeo.text_sam import LangSAM

image = "ortho.tif"
split_raster(image, out_dir="tiles", tile_size=(1024, 1024), overlap=100)

sam = LangSAM()

text_prompt = "tree"

sam.predict_batch(
    images='tiles',
    out_dir='masks_25',
    text_prompt=text_prompt,
    box_threshold=0.25,
    text_threshold=0.24,
    mask_multiplier=255,
    dtype='uint8',
    merge=True,
    verbose=True,
)

@giswqs
Copy link
Member

giswqs commented Aug 28, 2023

Try setting merge=False to see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants