LoginSignup
0
0

UltralyticsでSAM-Hを使う方法

Posted at

本文

Ultralyticsで提供されているSAM(Segment Anything Model)には、sam_b, sam_l, sam_h, mobile_samの4モデルがありますが、他のモデルと違ってsam_hのみは重みを自動でダウンロードしてくれません。ですが、SAM公式が出している重みをそのまま使えるみたいです。

  1. https://github.com/facebookresearch/segment-anything からvit_hの重みをダウンロードしてsam_h.ptにリネームします
  2. 適当なオプションで実行します
from ultralytics.models.sam import Predictor as SAMPredictor
overrides = dict(conf=0.25, task='segment', mode='predict', imgsz=1024, model='sam_h.pt')
predictor = SAMPredictor(overrides=overrides)
predictor(image)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0