
神经网络二值化是模型量化的极限情况,将神经网络中原本 32 位浮点数参数量化至 1 位定点数。通常神经网络计算量集中在乘加操作,二值权重使该操作只靠位运算就能完成,极大加速了神经网络的推断过程,同时能够最大程度地减小模型的存储占用和模型的计算量,WRPN 指出在定制化的FPGA 和ASIC 上,BNN 对比全精度可获得1000倍的功耗节省。但二值化会不可避免地导致严重的信息损失,其量化函数不连续性也给深度网络的优化带来了困难。模型结构采用最新的BNext二值化网络结构,首次让二值网络在ILSVRC-2012 ImageNet 上取得超过80%的Top-1精度。
采用最新提出的BNext-S结构。其结构如下图所示。

使用方式:
使用范围:
目标场景:
在ModelScope框架上,提供输入图片,即可通过简单的Pipeline调用来使用。
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
img_path = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/bird.JPEG'
image_classification = pipeline(Tasks.image_classification, 
                                model='damo/cv_bnext-small_image-classification_ImageNet-labels')
result = image_classification(img_path)
print(result)
测试时主要的预处理如下:
模型在ImageNet1K的测试集进行测试,结果如下:
| Model | top-1 acc | #params | 
|---|---|---|
| BNext-T | 72.3 | 5.3M | 
| BNext-S | 76.1 | 11.1M | 
| BNext-M | 78.3 | 20.4M | 
| BNext-L | 80.5 | 47.6M | 
@article{guo2022join,
  title={Join the High Accuracy Club on ImageNet with A Binary Neural Network Ticket},
  author={Guo, Nianhui and Bethge, Joseph and Meinel, Christoph and Yang, Haojin},
  journal={arXiv preprint arXiv:2211.12933},
  year={2022}
}