LoginSignup
7
3

More than 1 year has passed since last update.

yolov5のモデルをオフラインで使用する

Posted at
self.model = torch.hub.load('yolov5ディレクトリのパス', 'custom', path='使用するモデルのパス',source='local')
  • 第一引数:yolov5ディレクトリのパス
    • 厳密にはhubconf.pyが存在するディレクトリのパス
  • 第二引数:'custom'
  • 第三引数:使用するモデルのパス
  • 第四引数:'local'

具体例

  • pipでインストールしたyolov5を参照
  • 絶対パス

の場合

self.model = torch.hub.load("/usr/local/lib/python3.6/dist-packages/yolov5", 'custom', path=os.environ['HOME']+'/catkin_ws/src/ros_pkg/config/yolov5/yolov5s.pt',source='local')
7
3
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
7
3