You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从Detectron2 Model Zoo加载模型时遭遇SSLError问题求助

Detectron2模型加载时SSL证书验证失败

尝试从detectron2 model_zoo加载模型,执行代码如下:

from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor

cfg = get_cfg()
cfg.cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")

default_predictor = DefaultPredictor(cfg)

运行后出现SSLError:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)>

随后尝试直接使用requests库下载模型:

import requests
data = requests.get('/detectron2/COCO-Detection/faster_rcnn_R_50_FPN_1x/137257794/model_final_b275ba.pkl')

仍然报错:

SSLError: HTTPSConnectionPool(host='dl.fbaipublicfiles.com', port=443): Max retries exceeded with url: /detectron2/COCO-Detection/faster_rcnn_R_50_FPN_1x/137257794/model_final_b275ba.pkl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)')))

猜测原因可能是以下两种情况之一:

  • 下载次数达到上限,服务器阻止了请求;
  • 存在SSL证书链问题,导致库多次尝试连接失败后报错。

注:已查看相关帖子,但问题并不完全匹配。

内容的提问来源于stack exchange,提问作者user3731622

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 18:28:01