README.md

December 5, 2025 ยท View on GitHub

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}
}