mxnet胶子cv工具包
gluoncv-torch的Python项目详细描述
在pytorch中加载GluonCV模型。简单地 import gluoncvth获得比 torchvision:
importgluoncvthasgcvmodel=gcv.models.resnet50(pretrained=True)
安装:
pip install gluoncv-torch
可用型号
图像网
与 torchvision型号:
torchvision | gluoncvth | |||
---|---|---|---|---|
Model | Top-1 error | Top-5 error | Top-1 error | Top-5 error |
ResNet18 | 30.24 | 10.92 | 29.06 | 10.17 |
ResNet34 | 26.70 | 8.58 | 25.35 | 7.92 |
ResNet50 | 23.85 | 7.13 | 22.33 | 6.18 |
ResNet101 | 22.63 | 6.44 | 20.80 | 5.39 |
ResNet152 | 21.69 | 5.94 | 20.56 | 5.39 |
Inception v3 | 22.55 | 6.44 | 21.33 | 5.61 |
语义分割
Pascal VOC数据集的结果:
Model | Base Network | mIoU |
---|---|---|
FCN | ResNet101 | 83.6 |
PSPNet | ResNet101 | 85.1 |
DeepLabV3 | ResNet101 | 86.2 |
ADE20K数据集的结果:
Model | Base Network | PixAcc | mIoU |
---|---|---|---|
FCN | ResNet101 | 80.6 | 41.6 |
PSPNet | ResNet101 | 80.8 | 42.9 |
DeepLabV3 | ResNet101 | 81.1 | 44.1 |
快速演示
importtorchimportgluoncvth# Get the modelmodel=gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)model.eval()# Prepare the imageurl='https://github.com/zhanghang1989/image-data/blob/master/encoding/'+ \ 'segmentation/ade20k/ADE_val_00001142.jpg?raw=true'filename='example.jpg'img=gluoncvth.utils.load_image(gluoncvth.utils.download(url,filename)).unsqueeze(0)# Make predictionoutput=model.evaluate(img)predict=torch.max(output,1)[1].cpu().numpy()+1# Get color pallete for visualizationmask=gluoncvth.utils.get_mask_pallete(predict,'ade20k')mask.save('output.png')
API参考
resnet
- gluoncvth.models.resnet18(pretrained=True)
- gluoncvth.models.resnet34(pretrained=True)
- gluoncvth.models.resnet50(pretrained=True)
- gluoncvth.models.resnet101(pretrained=True)
- gluoncvth.models.resnet152(pretrained=True)
fcn
- gluoncvth.models.get_fcn_resnet101_voc(pretrained=True)
- gluoncvth.models.get_fcn_resnet101_ade(pretrained=True)
pspnet
- gluoncvth.models.get_psp_resnet101_voc(pretrained=True)
- gluoncvth.models.get_psp_resnet101_ade(pretrained=True)
深度标签v3
- gluoncvth.models.get_deeplab_resnet101_voc(pretrained=True)
- gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)
为什么GluonCV?
1。最先进的实现方法
2。预先培训的模型和教程
3。社区支持
我们希望gluoncv模型的pytorch推理api
有利于整个计算机视觉通信。