Instructions to use ustc-community/hgnet-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ustc-community/hgnet-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ustc-community/hgnet-v2")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ustc-community/hgnet-v2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
This is the HF transformers implementation for HGNet-V2
Model: HGNet-V2 - B4
A HGNet-V2 (High Performance GPU Net) image classification model.
Usage:
import torch
import requests
from PIL import Image
from transformers import HGNetV2ForImageClassification, AutoImageProcessor
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
image_processor = AutoImageProcessor.from_pretrained("ustc-community/hgnet-v2")
model = HGNetV2ForImageClassification.from_pretrained("ustc-community/hgnet-v2")
inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
outputs.logits.shape
torch.Size([1, 2])
- Downloads last month
- 62