Skip to main content

MXNet Gluon CV Toolkit

Project description

GluonCV-Torch

Load GluonCV Models in PyTorch. Simply import gluoncvth to getting better pretrained model than torchvision:

import gluoncvth as gcv
model = gcv.models.resnet50(pretrained=True)

Installation:

pip install gluoncv-torch

Available Models

ImageNet

ImageNet models single-crop error rates, comparing to the torchvision models:

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

More models available at GluonCV Image Classification ModelZoo

Semantic Segmentation

Results on Pascal VOC dataset:

Model Base Network mIoU
FCN ResNet101 83.6
PSPNet ResNet101 85.1
DeepLabV3 ResNet101 86.2

Results on ADE20K dataset:

Model Base Network PixAcc mIoU
FCN ResNet101 80.6 41.6
PSPNet ResNet101 80.8 42.9
DeepLabV3 ResNet101 81.1 44.1

Quick Demo

import torch
import gluoncvth

# Get the model
model = gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)
model.eval()

# Prepare the image
url = '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 prediction
output = model.evaluate(img)
predict = torch.max(output, 1)[1].cpu().numpy() + 1

# Get color pallete for visualization
mask = gluoncvth.utils.get_mask_pallete(predict, 'ade20k')
mask.save('output.png')

More models available at GluonCV Semantic Segmentation ModelZoo

API Reference

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)

DeepLabV3

  • gluoncvth.models.get_deeplab_resnet101_voc(pretrained=True)
  • gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)

Why GluonCV?

1. State-of-the-art Implementations

2. Pretrained Models and Tutorials

3. Community Support

We expect this PyTorch inference API for GluonCV models will be beneficial to the entire computer vision comunity.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gluoncv-torch-0.0.4b6042020.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

gluoncv_torch-0.0.4b6042020-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file gluoncv-torch-0.0.4b6042020.tar.gz.

File metadata

  • Download URL: gluoncv-torch-0.0.4b6042020.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for gluoncv-torch-0.0.4b6042020.tar.gz
Algorithm Hash digest
SHA256 5caa00ded7a80cdbb81d3ac458f0af24098d2e53a58a3de4cc80fe81b5c499f7
MD5 e68efcdb10f98a8aaa4ca0c20e3aa542
BLAKE2b-256 b2df8e16995b0549e99f86422b08e55b71011983161fcf56801f0681494f35da

See more details on using hashes here.

File details

Details for the file gluoncv_torch-0.0.4b6042020-py3-none-any.whl.

File metadata

  • Download URL: gluoncv_torch-0.0.4b6042020-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for gluoncv_torch-0.0.4b6042020-py3-none-any.whl
Algorithm Hash digest
SHA256 eab8cace5af1ac93cfad69a0e7ea31dfb43855f8ae11dab64d3bd5627e9d5a89
MD5 31ce6d1615a0ecd27acb4d38ded37bae
BLAKE2b-256 268ac47700cb366584f95f234bcdbcc3079025bc1d5e9f6884d3a1b967be0ad8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page