Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI PyPI Pre-release Upload Python Package Downloads

PyTorch-Encoding

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.

Release files for gluoncv-torch 0.0.5b20200628

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gluoncv-torch 0.0.5b20200628
File Size Uploaded
gluoncv-torch-0.0.5b20200628.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gluoncv-torch 0.0.5b20200628
File Interpreter ABI Platform
gluoncv_torch-0.0.5b20200628-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / gluoncv-torch-0.0.5b20200628.tar.gz

Download URL gluoncv-torch-0.0.5b20200628.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9010adab14e2c4c8d2dc0653f21a01ad3f46b0d5b8ae7dc49403ffd5d0dc7a5c
BLAKE2b-256 checksum
How to use checksums
7e8b02acc65b8807f65c6ad875c73aaba9f6df82de0227d1d5173d085fa6c5b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release files / gluoncv_torch-0.0.5b20200628-py3-none-any.whl

Download URL gluoncv_torch-0.0.5b20200628-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b26a73fc85a8812da84600e954cff5999657e3c6dd46f5286c6273599f8f9bde
BLAKE2b-256 checksum
How to use checksums
bac3989aa2de453827d895584c6cc48774ce1341bb6d95470ec4c26e8fd27c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page