Closed mdimtiazh closed 1 year ago
Thanks for your good work and suggestion!🥳 We will try your model and update our project.
The integration has been finished.
Where does this mobile_encoder
from? MobileSAM repo itself installs a package called mobile_sam
.
Yes, please follow the instruction provided by MobileSAM for the installation🫣, as we mentioned in our Readme:
I already did install them using this
cd dependencies/sam_ckpt/
git clone https://github.com/ChaoningZhang/MobileSAM.git
cd MobileSAM; pip install -e .
cp weights/mobile_sam.pt ../
and now I have mobile_sam
package on my pip installed package and their weight checkpoint.
When I try to run python run_seg_gui.py --config=configs/llff/seg/seg_fern.py --segment --sp_name=_gui --num_prompts=20 --render_opt=train --save_ckpt --mobile_sam
it throws an error ModuleNotFoundError: No module named 'mobile_encoder'
. I am not sure how you integrate MobileSAM to this repo.
It seems there have been some modification in MobileSAM since the previous integration. After checking MobileSAM's readme I find currently the backbone loading should be done as follows:
from mobile_sam import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
model_type = "vit_t"
sam_checkpoint = "./weights/mobile_sam.pt"
device = "cuda" if torch.cuda.is_available() else "cpu"
mobile_sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
mobile_sam.to(device=device)
mobile_sam.eval()
# the SAM predictor initialization
# predictor = SamPredictor(mobile_sam)
After you get the mobile_sam, just let self.sam = mobile_sam. Change the above mentioned code may help.
We will modify our code to adapt to their update.
I see. Then please let us know if it is updated, maybe by reopening this issue(?) Thank you!
The bug has been fixed😉
Reference: https://github.com/ChaoningZhang/MobileSAM
Our project performs on par with the original SAM and keeps exactly the same pipeline as the original SAM except for a change on the image encode, therefore, it is easy to Integrate into any project.
MobileSAM is around 60 times smaller and around 50 times faster than original SAM, and it is around 7 times smaller and around 5 times faster than the concurrent FastSAM. The comparison of the whole pipeline is summarzed as follows:
Best Wishes,
Qiao