当前位置: 首页>>代码示例>>Python>>正文


Python c2_model_loading.load_c2_format方法代码示例

本文整理汇总了Python中maskrcnn_benchmark.utils.c2_model_loading.load_c2_format方法的典型用法代码示例。如果您正苦于以下问题:Python c2_model_loading.load_c2_format方法的具体用法?Python c2_model_loading.load_c2_format怎么用?Python c2_model_loading.load_c2_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maskrcnn_benchmark.utils.c2_model_loading的用法示例。


在下文中一共展示了c2_model_loading.load_c2_format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _load_file

# 需要导入模块: from maskrcnn_benchmark.utils import c2_model_loading [as 别名]
# 或者: from maskrcnn_benchmark.utils.c2_model_loading import load_c2_format [as 别名]
def _load_file(self, f):
        # catalog lookup
        if f.startswith("catalog://"):
            paths_catalog = import_file(
                "maskrcnn_benchmark.config.paths_catalog", self.cfg.PATHS_CATALOG, True
            )
            catalog_f = paths_catalog.ModelCatalog.get(f[len("catalog://") :])
            self.logger.info("{} points to {}".format(f, catalog_f))
            f = catalog_f
        # download url files
        if f.startswith("http"):
            # if the file is a url path, download it and cache it
            cached_f = cache_url(f)
            self.logger.info("url {} cached in {}".format(f, cached_f))
            f = cached_f
        # convert Caffe2 checkpoint from pkl
        if f.endswith(".pkl"):
            return load_c2_format(self.cfg, f)
        # load native detectron.pytorch checkpoint
        loaded = super(DetectronCheckpointer, self)._load_file(f)
        if "model" not in loaded:
            loaded = dict(model=loaded)
        return loaded 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:25,代码来源:checkpoint.py

示例2: _load_file

# 需要导入模块: from maskrcnn_benchmark.utils import c2_model_loading [as 别名]
# 或者: from maskrcnn_benchmark.utils.c2_model_loading import load_c2_format [as 别名]
def _load_file(self, f):
        # catalog lookup
        if f.startswith("catalog://"):
            paths_catalog = import_file(
                "maskrcnn_benchmark.config.paths_catalog", self.cfg.PATHS_CATALOG, True
            )
            catalog_f = paths_catalog.ModelCatalog.get(f[len("catalog://") :])
            self.logger.info("{} points to {}".format(f, catalog_f))
            f = catalog_f
        # download url files
        if f.startswith("http"):
            # if the file is a url path, download it and cache it
            cached_f = cache_url(f, model_dir=self.cfg.MODEL.PRETRAINED_MODELS)
            self.logger.info("url {} cached in {}".format(f, cached_f))
            f = cached_f
        # convert Caffe2 checkpoint from pkl
        if f.endswith(".pkl"):
            return load_c2_format(self.cfg, f)
        # load native detectron.pytorch checkpoint
        loaded = super(DetectronCheckpointer, self)._load_file(f)
        if "model" not in loaded:
            loaded = dict(model=loaded)
        return loaded 
开发者ID:zjhuang22,项目名称:maskscoring_rcnn,代码行数:25,代码来源:checkpoint.py


注:本文中的maskrcnn_benchmark.utils.c2_model_loading.load_c2_format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。