mxnet model_zoo.get_model, 如何使用本地的parameter?

因为aws上下载模型很不稳定,所以想用下载工具把模型下载下来,然后拷贝到文件夹下面,下面代码解决:

net = model_zoo.get_model('mask_rcnn_resnet50_v1b_coco', pretrained=False, pretrained_base=False)
ctx = mx.gpu(0)
net.load_parameters('./mask_rcnn_resnet50_v1b_coco-a3527fdc.params', ctx=ctx,
                            ignore_extra=False, allow_missing=True)
im_fname = utils.download('https://github.com/dmlc/web-data/blob/master/' +
                          'gluoncv/detection/biking.jpg?raw=true',
                          path='biking.jpg')
x, orig_img = data.transforms.presets.rcnn.load_test(im_fname)
x = x.copyto(mx.gpu(0))  //这里很重要,否则会报错
发布了159 篇原创文章 · 获赞 55 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/northeastsqure/article/details/103512279