Initialise FastSAM is not working
Environment Information
- samgeo version: 0.10.2
- Python version: 3.11
- Operating System: Google Colab
Description
why can't I initialize the FastSAM model?
What I Did
Change to this but not working
sam = SamGeo(model="FastSAM-x.pt", checkpoint_dir="content/FastSAM-x.pt")
Hi @riokt I have the same issue in Google Collab for Samgeo vit_h when importing SamGeo like from samgeo.hq_sam import SamGeo
sam = SamGeo(
model_type="vit_h",
automatic=False,
sam_kwargs=None,
)
Yields:
Model checkpoint for `vit_h `not found.
Access denied with the following error:
Cannot retrieve the public link of the file. You may need to change
the permission to 'Anyone with the link', or have had many accesses.
But if I just import SamGeo like from samgeo import SamGeo I do not have an issue - so maybe see if that helps progress you?
In regards to the issue with importing from samgeo.hq_sam maybe this is unexpected behavior - I believe the error comes from the gdown module that is responsible for handling downloading content into Google Collab so I am curious if its something with segment-geospatial or some limitations with Google Collab handling that large download
[johngeoscrub](/johngeoscI
I have similar problem, the model from Samgeo.hq and FastSam , can not be downloaded automatically by system. And when i try to call the model (already downloaded in my laptop), it always failed. If you have solution, please share here. thank you
Same problem
@ihsan2805 @grannycola this is not a complete fix but can maybe unblock you for the time being - do you still have issues if you import SamGeo like this from samgeo import SamGeo instead of from samgeo.hq_sam import SamGeo ?
@johngeoscrub I used this:
from samgeo.fast_sam import SamGeo
sam = SamGeo(model="FastSAM-x.pt")
If i use from samgeo import SamGeo it works just fine.
@johngeoscrub yes, everything is normal when i use from samgeo import SamGeo
If the automatic download fails, you can download the checkpoints manually and put them in the directory ~/.cache/torch/hub/checkpoints. Alternatively, you can pass in the checkpoint_dir parameter pointing to your checkpoints directory when initializing SamGeo
- FastSAM-x.pt: https://drive.google.com/file/d/1m1sjY4ihXBU1fZXdQ-Xdj-mDltW-2Rqv/view?usp=sharing
- FastSAM-s.pt: https://drive.google.com/file/d/10XmSj6mmpmRb8NhXbtiuO9cTTBwR_9SV/view?usp=sharing