Skip to content

Commit

Permalink
Update docs for v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed Aug 21, 2019
1 parent 49bc3e9 commit a22bb11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions docs/onnx2bnn.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ The details is in https://github.com/JDAI-CV/dabnn/blob/master/tools/onnx2bnn/On

There are some notes for model conversion.

1. **The number of input channels of binary convs must be 64 or a multiple of 128 for now.**
1. Binary convolutions are custom operations in training frameworks (e.g., TensorFlow, PyTorch), so the implementations are various. Unfortunately, the most existing implementations of binary convs are not correct. For example, they always pad 0 to their input, while the input should only be +1 or -1. The developers of dabnn provide [a standard implementation of binary convs in PyTorch](https://gist.github.com/daquexian/7db1e7f1e0a92ab13ac1ad028233a9eb). We advise trainers of BNNs to use this implementation, or implement binary convs in their own training frameworks according to this implementation.

2. Binary convolutions are custom operations in training frameworks (e.g., TensorFlow, PyTorch), so the implementations are various. Unfortunately, the most existing implementations of binary convs are not correct. For example, they always pad 0 to their input, while the input should only be +1 or -1. The developers of dabnn provide [a standard implementation of binary convs in PyTorch](https://gist.github.com/daquexian/7db1e7f1e0a92ab13ac1ad028233a9eb). We advise trainers of BNNs to use this implementation, or implement binary convs in their own training frameworks according to this implementation.
2. onnx2bnn has multiple recognizing levels. It can even recognize the incorrect binary convs described above (the result will be incorrect though). Please check out [this documentation](https://github.com/JDAI-CV/dabnn/wiki/Train,-export-and-convert-a-dabnn-model) for details.

3. onnx2bnn has multiple recognizing levels. It can even recognize the incorrect binary convs described above (the result will be incorrect though). Please check out [this documentation](https://github.com/JDAI-CV/dabnn/wiki/Train,-export-and-convert-a-dabnn-model) for details.

4. `group` is not supported for now.
3. `group` is not supported for now.
8 changes: 3 additions & 5 deletions docs/onnx2bnn_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ ONNX (Open Neural Network Exchange) 是一个独立于训练框架的模型格

模型转换过程中有些规则或限制需要额外说明。

1. **二值卷积的输入 channel 暂时需要是 128 的倍数或 64**
1. 二值卷积是自定义操作,因此可能存在多种实现,网上存在的大部分二值卷积自定义实现是不完全正确的,例如它们用 0 进行 pad,而忽略了二值卷积的输入只能有 +1 和 -1。dabnn 开发者提供了一个[标准的二值卷积 PyTorch 实现](https://gist.github.com/daquexian/7db1e7f1e0a92ab13ac1ad028233a9eb),我们建议所有二值网络的训练者使用这个实现,或是按照这个实现来在他们用的训练框架中自行实现二值卷积

2. 二值卷积是自定义操作,因此可能存在多种实现,网上存在的大部分二值卷积自定义实现是不完全正确的,例如它们用 0 进行 pad,而忽略了二值卷积的输入只能有 +1 和 -1。dabnn 开发者提供了一个[标准的二值卷积 PyTorch 实现](https://gist.github.com/daquexian/7db1e7f1e0a92ab13ac1ad028233a9eb),我们建议所有二值网络的训练者使用这个实现,或是按照这个实现来在他们用的训练框架中自行实现二值卷积
2. onnx2bnn 有多种针对二值卷积的识别模式,例如会根据卷积的权重(是否为 +1/-1)识别、根据 Sign operator 识别,在用户选择 aggressive 模式时,甚至可以识别上一条所述的非正确的二值卷积(但在运算时仍会以 -1 而不是 0 来 pad,因此会导致结果不完全一致)。具体请看 [这篇文档](https://github.com/JDAI-CV/dabnn/wiki/Train,-export-and-convert-a-dabnn-model)

3. onnx2bnn 有多种针对二值卷积的识别模式,例如会根据卷积的权重(是否为 +1/-1)识别、根据 Sign operator 识别,在用户选择 aggressive 模式时,甚至可以识别上一条所述的非正确的二值卷积(但在运算时仍会以 -1 而不是 0 来 pad,因此会导致结果不完全一致)。具体请看 [这篇文档](https://github.com/JDAI-CV/dabnn/wiki/Train,-export-and-convert-a-dabnn-model)

4. 目前暂时不支持 `group` 参数。
3. 目前暂时不支持 `group` 参数。

0 comments on commit a22bb11

Please sign in to comment.