
 
    
    ---license: Apache License 2.0 tasks:- Multimodal Models- Image Segmentation---该模型是 [Segment Anything](https://ai.facebook.com/research/publications/segment-anything/) 的 paddle 实现, 可输入点或框进行分割。模型规模是vit-H,图像分辨率为1024*1024。#### Clone with HTTP在个人中心->模型->我的模型,查询访问令牌。可以通过令牌进行git仓库的使用。```bash git clone http://git.aistudio.baidu.com/aistudio/SamVitH-1024.git```### 快速开始安装 [PaddleMIX](https://github.com/PaddlePaddle/PaddleMIX)```bashimport numpy as npimport requestsfrom PIL import Imagefrom paddlemix.models.sam.modeling import SamModelfrom paddlemix.processors.sam_processing import SamProcessorurl = "https://paddlenlp.bj.bcebos.com/models/community/CompVis/stable-diffusion-v1-4/overture-creations.png"image_pil = Image.open(requests.get(url, stream=True).raw).convert("RGB")# build processorprocessor = SamProcessor.from_pretrained("aistudio/SamVitH-1024",from_aistudio=True)# build modelsam_model = SamModel.from_pretrained("aistudio/SamVitH-1024",from_aistudio=True,input_type="boxs")box_prompt = [174, 115, 311, 465]box_prompt = np.array(box_prompt)image_seg, prompt = processor(    image_pil,    input_type="boxs",    box=box_prompt,    point_coords=None)seg_masks = sam_model(img=image_seg, prompt=prompt)seg_masks = processor.postprocess_masks(seg_masks)```## 相关论文以及引用信息```@article{kirillov2023segany,  title={Segment Anything},  author={Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Doll{\'a}r, Piotr and Girshick, Ross},  journal={arXiv:2304.02643},  year={2023}}```