CASIA-IVA-Lab / FastSAM

Fast Segment Anything
GNU Affero General Public License v3.0
7.34k stars 682 forks source link

Split/corp image #192

Open nexusme opened 9 months ago

nexusme commented 9 months ago

Hi, i would like to know how can i corp my image if i only want the dog image by using: !python FastSAM/Inference.py --model_path FastSAM.pt --img_path ./images/dog.jpg --text_prompt "the white dog"? I only can get a image with a mask on dog.

YinglongDu commented 9 months ago

Thank you for your interest in FastSAM! You can get the mask from the prompt_process function, and then manipulate it with the original image to get the cropped image. https://github.com/CASIA-IVA-Lab/FastSAM/blob/4d153e909f0ad9c8ecd7632566e5a24e21cf0071/Inference.py#L98C64-L98C64 We will improve this feature later. :smiley: