Skip to content

Latest commit

 

History

History
 
 

swin-transformer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Swin Transformer for Image Classification

Input

Input

(from https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)

Shape : (1,3,224,224)

Output

class_count=3
+ idx=0
  category=981[ballplayer, baseball player ]
  prob=8.67708683013916
+ idx=1
  category=615[knee pad ]
  prob=5.741599082946777
+ idx=2
  category=880[unicycle, monocycle ]
  prob=5.625770568847656

Usage

Automatically downloads the onnx and prototxt files on the first run. It is necessary to be connected to the Internet while downloading.

For the sample image,

$ python3 swin_transformer.py

If you want to specify the input image, put the image path after the --input option.

$ python3 swin_transformer.py --input IMAGE_PATH

By adding the --video option, you can input the video.
If you pass 0 as an argument to VIDEO_PATH, you can use the webcam input instead of the video file.

$ python3 swin_transformer.py --video VIDEO_PATH

Reference

Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

Swin Transformer

IMAGENET

ImageNet 1000 (mini)

Framework

Pytorch

Model Format

ONNX opset = 11

Netron

swin-transformer_tiny_patch4_window7_224.onnx.prototxt