Skip to content

Exception: 'NoneType' object has no attribute 'crop' #191

Open
@hrezvan

Description

@hrezvan

I am trying to implement FastSAM in a for loop. I have a couple of bboxes in a list like below:
bbox[4:7] [[58.925381, 31.177402, 58.940381, 31.167402],
[58.940381, 31.167402, 58.955381, 31.157402],
[58.955381, 31.157402, 58.970381, 31.147402]]
in each loop I want to have a segmentation. every things is OK until the sixth loop which I get the Exception: 'NoneType' object has no attribute 'crop' error message for the tms_to_geotiff function. how can I solve this issue?
BTW here is my for loop code:

for j in range(len(bbox)):
  tms_to_geotiff(output='Image.tif', bbox=bbox[j], zoom=19, source="Satellite", overwrite=True)
  sam.set_image('Image.tif')
  output_mask_name = 'mask_'+str(j)+'.tif'
  sam.everything_prompt(output=output_mask_name)
  output_geojson_name = 'mask_'+str(j)+'.geojson'
  sam.raster_to_vector(output_mask_name, output_geojson_name)

In addition to the for loop, sometimes when I want to segment objects according to the FastSAM notebook, I get this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions