二值神经网络(Binary Neural Network,BNN)

本文综述了二值神经网络(BNN)、XNOR-Net、Bi-RealNet和ABCnet等前沿研究,探讨了这些网络如何通过限制权重和激活到+1或-1来提高效率,同时保持良好的性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载自多篇博客,仅用作个人学习,如需删除,请见谅并联系本人。

BNN

Bengio大神的著作《Binarized Neural Networks: Training Neural Networks with Weights and Activations Constrained to +1 or −1》:

链接:https://arxiv.org/abs/1602.02830

参考代码:https://github.com/MatthieuCourbariaux/BinaryNet

参考博文:https://blog.youkuaiyun.com/lily_9/article/details/81409249 

                  https://blog.youkuaiyun.com/stdcoutzyx/article/details/50926174

XNOR-Net算法

博客:https://blog.youkuaiyun.com/u014380165/article/details/77731595

论文:XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks 
链接:https://arxiv.org/abs/1603.05279 
代码地址:http://allenai.org/plato/xnornet


Bi-Real Net——XNOR-net的增强与演进

Bi-Real Net: Enhancing the Performance of 1bit CNNs with Improved Representational Capacity and Advanced Training Algorithm

博客:https://blog.youkuaiyun.com/nature553863/article/details/82497777 

Paper地址:https://arxiv.org/abs/1808.00278v5

GitHub(Bi-Real net,Caffe):https://github.com/liuzechun/Bi-Real-net

GitHub(XNOR-net,PyTorch):https://github.com/jiecaoyu/XNOR-Net-PyTorch

ABCnet

Towards Accurate Binary Convolutional Neural Network"这篇文章提出了ABCnet,是一种表示精度较高的二值化网络结构(作为XNORnet的演进)。有关XNORnet及其优势可以参考论文:"XNORNet: ImageNet Classification Using Binary Convolutional Neural Networks"。

博客:https://blog.youkuaiyun.com/nature553863/article/details/80653521 

论文地址:https://arxiv.org/abs/1711.11294

ABCnet GitHub:https://github.com/layog/Accurate-Binary-Convolution-Network

XNORnet GitHub:https://github.com/ayush29feb/Sketch-A-XNORNet
 

### 关于神经网络 (BNN) 的模型结构 神经网络Binary Neural Network, BNN)是一种特殊的深度学习模型,其中权重和激活函数仅限于+1和-1两个。这种极端的量化方式显著减少了存储需求和计算复杂度,使得BNN非常适合移动设备和其他资源受限环境下的部署。 #### 神经网络的基本架构特点 典型的神经网络由多个化的卷积层组成,这些层之间通常会穿插有批量归一化(Batch Normalization)操作和线性整流单元(Binary ReLU)[^2]。具体来说: - **输入层**:接收原始图像数据或其他类型的特征向量。 - **化处理**:在网络内部,除了第一个全连接层外,所有的权重都被转换成±1的形式;同样地,除最后一层之外的所有中间表示也被映射到这两个离散数上[^3]。 - **特殊组件**: - 对某些改进版本如ReActNet,在传统MobileNet V1的基础上进行了调整,替换了原有的深度可分离卷积(deepwise separable convolutions),转而采用标准形式的一维/维卷积,并引入了跳跃连接(shortcut connections)[^4]。 - 另一种先进的设计方案MeliusNet,则进一步优化了整体性能表现,使其能够在ImageNet分类任务上的准确性接近甚至超越非化的轻量级模型——例如MobileNet系列。 为了帮助理解具体的构建细节,下面给出一个简化版的神经网络架构示意代码片段: ```python import torch.nn as nn class BinaryConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3): super().__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size) def forward(self, x): # 假设这里实现了某种化机制 binary_weight = binarize(self.conv.weight) output = F.conv2d(x, weight=binary_weight, bias=self.conv.bias, stride=self.conv.stride, padding=self.conv.padding) return output def create_binary_network(): layers = [] current_channels = input_channels for channels in channel_sizes: layer = BinaryConvLayer(current_channels, channels) bn_layer = nn.BatchNorm2d(channels) relu_layer = nn.ReLU() layers.extend([layer, bn_layer, relu_layer]) current_channels = channels model = nn.Sequential(*layers) return model ``` 此段伪代码展示了如何定义一个简单的卷积模块及其组合形成完整的网络实例过程。需要注意的是,“binarize”函数代表了一个理想化的变换逻辑,实际实现时可能涉及更多复杂的数学运算和技术考量。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值