Giter Site home page Giter Site logo

xyonglu / sbcformer Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 3.0 486 KB

[Pytorch Impl.] SBCFormer: Lightweight Network Capable of Full-size ImageNet Classification at 1 FPS on Single Board Computers -WACV2024 -Official Code

License: MIT License

Python 100.00%

sbcformer's Introduction

SBCFormer

SBCFormer: Lightweight Network Capable of Full-size ImageNet Classification at 1 FPS on Single Board Computers

Introduction

  • This paper introduces a CNN-ViT hybrid network called SBCFormer, which achieves high accuracy and fast computation on such low-end CPUs.
  • We compare our SBCFormers against a wide range of relevant and up-todate alternatives.
  • SBCFormer uses the proposed hourglass attention computation to aggregate global information from the entire image while minimizing computational costs.
  • SBCFormer achieves the highest trade-off between accuracy and speed on a Raspberry Pi 4 Model B with an ARM-Cortex A72 CPU.
  • SBCFormer as a new backbone is available for various tasks: ImageNet-1K Classification, object detection, and monocular depth estimation.[Successful Implementation].

Architecture


Classification on ImageNet-1K

Performance


Models are trained on ImageNet-1K and measured the latency performance on ARM and Intel CPUs.

Data Preparation

Download and extract ImageNet train and val images from http://image-net.org/. The training and validation data are expected to be in the train folder and val folder respectively:

/path/to/imagenet/
  train/
    class1/
      img1.jpeg
    class2/
      img2.jpeg
  val/
    class1/
      img3.jpeg
    class/2
      img4.jpeg

Training

Training the SBCFormer_B on ImageNet with an 4-gpu server for 300 epochs:

OMP_NUM_THREADS=1 torchrun --nnodes 1 --nproc_per_node=4 --master_port 29502 main.py --lr 2.5e-4 --model "SBCFormer_B"  --resume "" --data-set "IMNET" --data-path "/path/to/imagenet" --input-size 224 --batch-size 1024  --epochs 300

Evaluation

Evaluating the trained SBCFormer_B on ImageNet is available:

python main.py --model "SBCFormer_B"  --eval --resume "/path/to/checkpoint" --data-set "IMNET" --data-path "/path/to/imagenet" --input-size 224 --batch-size 1024 --epochs 300 

The trained SBCFormer_B model can be downloaded from [SBCFormer_B, 80.0%]

Acknowledgement

This repository is built using the timm library and the DeiT repository.

Citation

If our code or models help your work, please cite SBCFormer (WACV2024):

@inproceedings{lu2024sbcformer,
  title={SBCFormer: Lightweight Network Capable of Full-size ImageNet Classification at 1 FPS on Single Board Computers},
  author={Lu, Xiangyong and Suganuma, Masanori and Okatani, Takayuki},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  pages={1123--1133},
  year={2024}
}

sbcformer's People

Contributors

xyonglu avatar

Stargazers

Xshen avatar  avatar cspk avatar  avatar zhaowenhao avatar  avatar Jeff Carpenter avatar  avatar BosMutus avatar Thananop Kobchaisawat avatar  avatar  avatar Xiaoteng Zhang avatar xinghaidemao avatar Akhdan Fadhilah avatar  avatar  avatar Wang Shuo avatar Peter Liu avatar  avatar An-zhi WANG avatar heart avatar rotorliu avatar Xiaoqi_ avatar Zhang Yu avatar bluo avatar  avatar happy avatar Junlin Chang avatar  avatar Do Phuc Hao avatar  avatar Junjie Hu avatar  avatar 刘国友 avatar

Watchers

刘国友 avatar  avatar

sbcformer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.