Code Monkey home page Code Monkey logo

Comments (10)

FateScript avatar FateScript commented on July 18, 2024

环境

1.系统环境:Ubuntu 18.04
2.MegEngine版本:0.4.0
3.python版本:3.6.8
4.模型名称:retinanet_res50_1x_800size

复现步骤

请提供关键的代码片段便于追查问题

from megengine import hub
model = hub.load(
"megengine/models",
"retinanet_res50_1x_800size",
pretrained=True,
)

请提供完整的日志及报错信息

Traceback (most recent call last):
File "", line 4, in
File "/usr/local/lib/python3.6/dist-packages/megengine/hub/hub.py", line 202, in load
raise RuntimeError("Cannot find callable {} in hubconf.py".format(entry))
RuntimeError: Cannot find callable retinanet_res50_1x_800size in hubconf.py

看起来是cache没更新的问题,可以使用

model = hub.load(
    "megengine/models", "retinanet_res50_1x_800size",
    pretrained=True, use_cache=False
)

试一下,应该会重新download一份新的retinanet

from models.

davidishere avatar davidishere commented on July 18, 2024

修改后报下面的错误:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/megengine/hub/hub.py", line 206, in load
module = getattr(hubmodule, entry)(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/megengine/hub/hub.py", line 317, in pretrained_model_func
model = func(**kwargs)
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/retinanet_res50_coco_1x_800size.py", line 23, in retinanet_res50_coco_1x_800size
return models.RetinaNet(models.RetinaNetConfig(), batch_size=batch_size, **kwargs)
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/models/retinanet.py", line 39, in init
bottom_up = resnet50(norm=layers.get_norm(self.cfg.resnet_norm))
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/layers/basic/norm.py", line 71, in get_norm
"SyncBN": M.SyncBatchNorm,
AttributeError: module 'megengine.module' has no attribute 'SyncBatchNorm'

from models.

FateScript avatar FateScript commented on July 18, 2024

修改后报下面的错误:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/megengine/hub/hub.py", line 206, in load
module = getattr(hubmodule, entry)(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/megengine/hub/hub.py", line 317, in pretrained_model_func
model = func(**kwargs)
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/retinanet_res50_coco_1x_800size.py", line 23, in retinanet_res50_coco_1x_800size
return models.RetinaNet(models.RetinaNetConfig(), batch_size=batch_size, **kwargs)
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/models/retinanet.py", line 39, in init
bottom_up = resnet50(norm=layers.get_norm(self.cfg.resnet_norm))
File "/root/.cache/megengine/hub/e093aa62cdf8f313/official/vision/detection/layers/basic/norm.py", line 71, in get_norm
"SyncBN": M.SyncBatchNorm,
AttributeError: module 'megengine.module' has no attribute 'SyncBatchNorm'

哦哦,这个是0.5.0里面即将发布的Sync bn,目前0.4.0还不支持,可以把这一行注释掉

from models.

davidishere avatar davidishere commented on July 18, 2024

您好,我看了retinanet的配置,并没有用Sync bn
class RetinaNetConfig:
def init(self):
self.resnet_norm = "FrozenBN"
self.backbone_freeze_at = 2

retinanet_res50_coco_1x_800size.py

from megengine import hub

from official.vision.detection import models

@hub.pretrained(
"https://data.megengine.org.cn/models/weights/"
"retinanet_d3f58dce_res50_1x_800size_36dot0.pkl"
)
def retinanet_res50_coco_1x_800size(batch_size=1, **kwargs):
r"""
RetinaNet trained from COCO dataset.
"RetinaNet" <https://arxiv.org/abs/1708.02002>_
"""
return models.RetinaNet(models.RetinaNetConfig(), batch_size=batch_size, **kwargs)

Net = models.RetinaNet
Cfg = models.RetinaNetConfig

并没有调用retinanet_res50_coco_1x_800size_syncbn.py

from models.

FateScript avatar FateScript commented on July 18, 2024

您好,我看了retinanet的配置,并没有用Sync bn
class RetinaNetConfig:
def init(self):
self.resnet_norm = "FrozenBN"
self.backbone_freeze_at = 2

retinanet_res50_coco_1x_800size.py

from megengine import hub

from official.vision.detection import models

@hub.pretrained(
"https://data.megengine.org.cn/models/weights/"
"retinanet_d3f58dce_res50_1x_800size_36dot0.pkl"
)
def retinanet_res50_coco_1x_800size(batch_size=1, **kwargs):
r"""
RetinaNet trained from COCO dataset.
"RetinaNet" <https://arxiv.org/abs/1708.02002>_
"""
return models.RetinaNet(models.RetinaNetConfig(), batch_size=batch_size, **kwargs)

Net = models.RetinaNet
Cfg = models.RetinaNetConfig

并没有调用retinanet_res50_coco_1x_800size_syncbn.py

没有使用sync bn的原因是相关的模型还在训练中,另外模型提交到hub也需要一定时间

from models.

davidishere avatar davidishere commented on July 18, 2024

那是不是现在retinanet模型的预训练权重还无法使用?需要自己重新训练

from models.

FateScript avatar FateScript commented on July 18, 2024

那是不是现在retinanet模型的预训练权重还无法使用?需要自己重新训练

可以使用啊,只不过是sync bn的功能不支持而已,正常RetinaNet使用的是Frozen BN

from models.

davidishere avatar davidishere commented on July 18, 2024

您好,现在的代码中就是使用的Frozen BN,不知道为什么说用了sync bn,您可以试一下看看是不是有问题?

from models.

FateScript avatar FateScript commented on July 18, 2024

您好,现在的代码中就是使用的Frozen BN,不知道为什么说用了sync bn,您可以试一下看看是不是有问题?

您好,这个地方多了一个SyncBn,而现在0.4.0版本的MegEngine并不支持,我的意思是注释掉这一行你就可以正常使用RetinaNet了,您可以试一下

from models.

davidishere avatar davidishere commented on July 18, 2024

OK,谢谢!

from models.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.