hf_mirrors/hrnet_w18.ms_aug_in1k
Model Introduction
Files & versions
Analysis
You are visiting the mirror address of https://modelers.cn/CICC/hrnet_w18.ms_aug_in1k. The repo is synchronized in real-time and is only for mirror acceleration access.

Model card for hrnet_w18.ms_aug_in1k

A HRNet image classification model. Trained on ImageNet-1k by paper authors.

Model Details

  • Model Type: Image classification / feature backbone
  • Model Stats:
    • Params (M): 21.3
    • GMACs: 4.3
    • Activations (M): 16.3
    • Image size: 224 x 224
  • Papers:
    • Deep High-Resolution Representation Learning for Visual Recognition: https://arxiv.org/abs/1908.07919
  • Original: https://github.com/HRNet/HRNet-Image-Classification
  • Dataset: ImageNet-1k

Model Usage

Feature Map Extraction

from PIL import Image
import timm
from timm.models.efficientnet import _cfg
from openmind import is_torch_npu_available
import torch_npu
import torch
import argparse
from openmind_hub import snapshot_download

if is_torch_npu_available():
    device = "npu:0"
else:
    device = "cpu"

def parse_args():
        parser = argparse.ArgumentParser()
        parser.add_argument( "--model_name_or_path", type=str, default="hrnet_w18.ms_aug_in1k", )
        args = parser.parse_args()
        return args
args = parse_args()

if args.model_name_or_path:
	model_path = args.model_name_or_path
else:
	model_path = snapshot_download(
		"CICC/hrnet_w18.ms_aug_in1k",
		revision="main",
		resume_download=True,
		ignore_patterns=["*.h5", "*.ot", "	*.msgpack"]
	)
# load tokenizer
img = Image.open('./beignets-task-guide.png')

config = _cfg(url='', file='model.safetensors')
model = timm.create_model("hrnet_w18.ms_aug_in1k", pretrained=True, pretrained_cfg=config).to(device)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0).npu())  # unsqueeze single image into batch of 1
print(output)

for o in output:
    # print shape of each feature map in output
    # e.g.:
    #  torch.Size([1, 64, 147, 147])
    #  torch.Size([1, 192, 71, 71])
    #  torch.Size([1, 288, 35, 35])
    #  torch.Size([1, 768, 17, 17])
    #  torch.Size([1, 2048, 8, 8])

    print(o.shape)

Model Comparison

Explore the dataset and runtime metrics of this model in timm model results.

Citation

@article{WangSCJDZLMTWLX19,
  title={Deep High-Resolution Representation Learning for Visual Recognition},
  author={Jingdong Wang and Ke Sun and Tianheng Cheng and 
          Borui Jiang and Chaorui Deng and Yang Zhao and Dong Liu and Yadong Mu and 
          Mingkui Tan and Xinggang Wang and Wenyu Liu and Bin Xiao},
  journal   = {TPAMI}
  year={2019}
}