Skip to content

Ruichen0424/AB-BNN

Repository files navigation

A&B BNN: Add&Bit-Operation-Only Hardware-Friendly Binary Neural Network

Paper CVPR 2024 Google Scholar IEEE

Hugging Face Hugging Face

YouTube Bilibili


🚀 Introduction

This is the official PyTorch implementation of the paper A&B BNN: Add&Bit-Operation-Only Hardware-Friendly Binary Neural Network, published in CVPR 2024.

Poster

📄 Abstract

Binary neural networks utilize 1-bit quantized weights and activations to reduce both the model's storage demands and computational burden. However, advanced binary architectures still incorporate millions of inefficient and non-hardware-friendly full-precision multiplication operations. A&B BNN is proposed to directly remove part of the multiplication operations in a traditional BNN and replace the rest with an equal number of bit operations, introducing the mask layer and the quantized RPReLU structure based on the normalizer-free network architecture. The mask layer can be removed during inference by leveraging the intrinsic characteristics of BNN with straightforward mathematical transformations to avoid the associated multiplication operations. The quantized RPReLU structure enables more efficient bit operations by constraining its slope to be integer powers of 2. Experimental results achieved 92.30%, 69.35%, and 66.89% on the CIFAR-10, CIFAR-100, and ImageNet datasets, respectively, which are competitive with the state-of-the-art. Ablation studies have verified the efficacy of the quantized RPReLU structure, leading to a 1.14% enhancement on the ImageNet compared to using a fixed slope RLeakyReLU. The proposed add&bit-operation-only BNN offers an innovative approach for hardware-friendly network architecture.

🛠️ Requirements

  • python==3.8
  • pytorch==2.0.1

💻 Usage

Network Architecture

The network definitions are located in the ./Network directory.

Training

We provide training scripts for both CIFAR and ImageNet datasets. The training process is divided into two steps.

Inference

The inference scripts are located in the ./Inference directory.

🤖 Pre-trained Models

The pre-trained models can be downloaded below. The codes for inference can be found in ./Inference.

Download Links:

Hugging Face Baidu Netdisk

📊 Main Results

Dataset Structure # Params Top-1 Acc Downloadable
CIFAR10 ReActNet-18 11.18 M 91.94%
ReActNet-A 28.32 M 89.44%
CIFAR100 ReActNet-18 11.23 M 69.35%
ReActNet-A 28.41 M 63.23%
ImageNet ReActNet-18 11.70 M 61.39%
ReActNet-34 21.82 M 65.19%
ReActNet-A 29.33 M 66.89%

📜 Citation

If you find our code useful for your research, please consider citing:

@inproceedings{ma2024b,
  title={A\&B BNN: Add\&Bit-Operation-Only Hardware-Friendly Binary Neural Network},
  author={Ma, Ruichen and Qiao, Guanchao and Liu, Yian and Meng, Liwei and Ning, Ning and Liu, Yang and Hu, Shaogang},
  booktitle={2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  pages={5704--5713},
  year={2024},
  organization={IEEE}
}

About

[CVPR 2024] Official implementation for "A&B BNN: Add&Bit-Operation-Only Hardware-Friendly Binary Neural Network"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors