Skip to content

Commit

Permalink
Merge branch 'v1.2.1_beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
jianfeifeng committed Oct 1, 2021
2 parents 0bb72dc + b842d5a commit f5bf1cf
Show file tree
Hide file tree
Showing 1,111 changed files with 107,124 additions and 33,246 deletions.
8 changes: 4 additions & 4 deletions .Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ OPTIMIZE_OUTPUT_FOR_C = YES
# qualified scopes will look different, etc.
# The default value is: NO.

OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_OUTPUT_JAVA = YES

# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources. Doxygen will then generate output that is tailored for Fortran.
Expand Down Expand Up @@ -281,7 +281,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.

EXTENSION_MAPPING =
EXTENSION_MAPPING = proto=C++

# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
Expand Down Expand Up @@ -771,8 +771,8 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = ./inference/engine/api/java ./inference/engine/api/c \
./inference/flow/include/flow.h ./common/uni/include/task.h ./inference/flow/src/flow.proto
INPUT = ./inference/engine/api ./inference/flow/include/flow.h \
./common/uni/include/task.h ./inference/flow/src/flow.proto

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux-android-armv7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
cd ..
chmod +x install.sh
./install.sh --target=android-armv7 -t 32
3 changes: 2 additions & 1 deletion .github/workflows/linux-android-armv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
cd ..
./install.sh --target=android-aarch64 --mali
chmod +x install.sh
./install.sh --target=android-aarch64
1 change: 1 addition & 0 deletions .github/workflows/linux-android-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
cd ..
chmod +x install.sh
./install.sh --target=android-x86_64
1 change: 1 addition & 0 deletions .github/workflows/linux-x86-avx2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
uses: actions/checkout@v2
- name: compile x86-avx2 on linux
run: |
chmod +x install.sh
./install.sh --target=linux-x86_64_avx2 -t 32
1 change: 1 addition & 0 deletions .github/workflows/linux-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
uses: actions/checkout@v2
- name: compile x86 on linux
run: |
chmod +x install.sh
./install.sh --target=linux-x86_64 -t 32
1 change: 1 addition & 0 deletions .github/workflows/macos-android-armv7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
cd ..
chmod +x install.sh
./install.sh --target=android-armv7
3 changes: 2 additions & 1 deletion .github/workflows/macos-android-armv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
cd ..
./install.sh --target=android-aarch64 --mali
chmod +x install.sh
./install.sh --target=android-aarch64
1 change: 1 addition & 0 deletions .github/workflows/macos-android-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
export ANDROID_NDK_ROOT=${PWD}/android-ndk-r20b
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
cd ..
chmod +x install.sh
./install.sh --target=android-x86_64
1 change: 1 addition & 0 deletions .github/workflows/macos-ios-armv7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ jobs:
echo 'export FLAGS_GETOPT_CMD="$(brew --prefix gnu-getopt)/bin/getopt"' >> /Users/runner/.bash_profile
source /Users/runner/.bash_profile
export IOS_SDK_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
chmod +x install.sh
./install.sh --target=ios-armv7
1 change: 1 addition & 0 deletions .github/workflows/macos-ios-armv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ jobs:
echo 'export FLAGS_GETOPT_CMD="$(brew --prefix gnu-getopt)/bin/getopt"' >> /Users/runner/.bash_profile
source /Users/runner/.bash_profile
export IOS_SDK_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
chmod +x install.sh
./install.sh --target=ios-aarch64
1 change: 1 addition & 0 deletions .github/workflows/macos-x86-avx2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ jobs:
gcc -v
g++ -v
cd $BOLT_PATH
chmod +x install.sh
./install.sh --target=macos-x86_64_avx2 -t 32
2 changes: 1 addition & 1 deletion .github/workflows/macos-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> /Users/runner/.bash_profile
echo 'export FLAGS_GETOPT_CMD="$(brew --prefix gnu-getopt)/bin/getopt"' >> /Users/runner/.bash_profile
source /Users/runner/.bash_profile
./install.sh --target=macos-x86_64
chmod +x install.sh && ./install.sh --target=macos-x86_64
2 changes: 1 addition & 1 deletion .github/workflows/windows-android-armv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/windows-x86_64/bin:$PATH
export PATH=$PATH:/d/a/bolt/bolt/software/wget
cd /d/a/bolt/bolt
./install.sh --target=android-aarch64 --mali
./install.sh --target=android-aarch64
shell: bash
58 changes: 51 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,59 @@ lib/*
*/install_*/*
*/bin/*
*/lib/*

third_party/*

caffe_pb2.py
*.o
*.a
*.so
*.bin
*.swp

_book
node_modules
__pycache__
inference/flow/include/flow.pb.h
caffe_pb2.py

model_tools/tools/tensorflow2caffe/*/*.txt
model_tools/tools/tensorflow2caffe/*/*.npy

*.bolt
*.onnx
*.tflite
*.pb
*.prototxt
*.caffemodel
*.pdf

third_party

common/gcl/tools/kernel_lib_compile/bin2char
common/gcl/tools/kernel_lib_compile/gcl_binary
common/gcl/tools/kernel_lib_compile/gcl_device_name
common/gcl/tools/kernel_lib_compile/include
common/gcl/tools/kernel_lib_compile/src
common/gcl/tools/kernel_lib_compile/build
common/gcl/tools/kernel_lib_compile/name
common/gcl/tools/kernel_lib_compile/cl
common/gcl/kernelBin
common/gcl/tools/kernel_source_compile/include
common/gcl/tools/kernel_source_compile/src
kit/iOS/ImageClassification/ImageClassificationDemo/libbolt/imagenet_classes.txt
kit/iOS/ImageClassification/ImageClassificationDemo/libbolt/headers
kit/Android/ImageClassification/app/src/main/assets/imagenet_classes.txt
kit/Android/ImageClassification/app/src/main/cpp/libbolt/headers
kit/Android/CameraEnlarge/app/src/main/cpp/libbolt/headers
kit/iOS/CameraEnlarge/CameraEnlarge/libbolt/headers
kit/Android/SimpleImageClassification/app/src/main/assets
kit/Android/SimpleImageClassification/app/src/main/java
kit/iOS/SimpleImgClassfication/libbolt
kit/Android/Semantics/app/src/main/java
kit/Android/Semantics/app/src/main/assets/


docs/API/html
kit/Android
kit/iOS
final_combinations.txt
single_combinations.txt
mt_result.txt
ptq_result.txt
engine_result.txt
tmp.txt
report.csv
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ endif (USE_TFLITE)
if (USE_TENSORFLOW)
find_package(jsoncpp)
endif (USE_TENSORFLOW)
if (USE_MALI)
if (USE_GPU)
find_package(Gcl)
endif(USE_MALI)
endif(USE_GPU)
if (NOT "$ENV{JNI_ROOT}" STREQUAL "")
find_package(JNI)
if (JNI_FOUND)
Expand All @@ -27,6 +27,9 @@ if (NOT "$ENV{JNI_ROOT}" STREQUAL "")
endif ()
if (BUILD_TEST)
find_package(jpeg)
if (EXISTS ${OpenCV_CMAKE_PATH})
include(${OpenCV_CMAKE_PATH})
endif()
endif (BUILD_TEST)

add_subdirectory(common)
Expand Down Expand Up @@ -75,9 +78,9 @@ if (BASH_PROGRAM AND USE_GENERAL)
else()
set(parameters ${parameters} -d unknown)
endif()
if (USE_MALI)
if (USE_GPU)
set(parameters ${parameters} -g)
endif(USE_MALI)
endif(USE_GPU)
if (USE_DYNAMIC_LIBRARY)
set(parameters ${parameters} --shared)
endif(USE_DYNAMIC_LIBRARY)
Expand Down
52 changes: 35 additions & 17 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Introduction

---
[![License: MIT](docs/images/license-mit.png)](https://opensource.org/licenses/MIT)

[Bolt](https://huawei-noah.github.io/bolt/) is a light-weight library for deep learning. Bolt, as a universal deployment tool for all kinds of neural networks, aims to minimize the inference runtime as much as possible.
Bolt has been widely deployed and used in many departments of HUAWEI company, such as 2012 Laboratory, CBG and HUAWEI Product Lines.
If you have questions or suggestions, you can submit issue. **QQ群: 833345709**

# Why Bolt is what you need?

---
- **High Performance:** **15%+** faster than existing open source acceleration libraries.
- **Rich Model Conversion:** support Caffe, ONNX, TFLite, Tensorflow.
- **Various Inference Precision:** support FP32, FP16, INT8, 1-BIT.
- **Multiple platforms:** ARM CPU(v7, v8, v8.2), Mali GPU, X86(AVX2)
- **Multiple platforms:** ARM CPU(v7, v8, v8.2), Mali GPU, Qualcomm GPU, X86 CPU(AVX2, AVX512)
- **Bolt is the first to support NLP and also supports common CV applications.**
- **Minimize ROM/RAM**
- Rich Graph Optimization
Expand All @@ -22,13 +22,13 @@ If you have questions or suggestions, you can submit issue. **QQ群: 833345709**
[See more excellent features and details here](https://zhuanlan.zhihu.com/p/317111024)

# Building Status

---
Kinds of choices are provided for the compilation of bolt. Please make a suitable choice depending on your environment.

| target platform | build command | Linux | Windows | MacOS |
| -------------------- | -------------------------------------------- | ----- | ------- | ----- |
| Android(armv7) | ./install.sh --target=android-armv7 | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/linux-android-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Alinux-android-armv7) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/windows-android-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Awindows-android-armv7) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-android-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-android-armv7) |
| Android(armv8+mali) | ./install.sh --target=android-aarch64 --mali | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/linux-android-armv8)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Alinux-android-armv8) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/windows-android-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Awindows-android-armv8) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-android-armv8)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-android-armv8) |
| Android(armv8+gpu) | ./install.sh --target=android-aarch64 --gpu | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/linux-android-armv8)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Alinux-android-armv8) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/windows-android-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Awindows-android-armv8) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-android-armv8)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-android-armv8) |
| Android(x86_64) | ./install.sh --target=android-x86_64 | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/linux-android-x86_64)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Alinux-android-x86_64) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/windows-android-x86_64)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Awindows-android-x86_64) | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-android-x86_64)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-android-x86_64) |
| iOS(armv7) | ./install.sh --target=ios-armv7 | / | / | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-ios-armv7)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-ios-armv7) |
| iOS(armv8) | ./install.sh --target=ios-aarch64 | / | / | [![Build Status](https://img.shields.io/github/workflow/status/huawei-noah/bolt/macos-ios-armv8)](https://github.com/huawei-noah/bolt/actions?query=workflow%3Amacos-ios-armv8) |
Expand All @@ -42,19 +42,25 @@ Kinds of choices are provided for the compilation of bolt. Please make a suitabl
*NOTE: Bolt defaultly link static library, This may cause some problem on some platforms. You can use --shared option to link shared library.*

# Quick Start

<div align=center><img src="docs/images/QuickStart.jpg" width = 80% height = 80% /></div>

---
<div align=center><img src="docs/images/QuickStart.jpg" width = 100% height = 100% style="border: 1px solid rgba(151,151,151,0.50)" /></div>
Two steps to get started with bolt.

1. Conversion: use **[X2bolt](/model_tools/tools/X2bolt/X2bolt.cpp)** to convert your model from caffe,onnx,tflite or tensorflow to .bolt;
1. Conversion: use **[X2bolt](model_tools/tools/X2bolt/X2bolt.cpp)** to convert your model from caffe,onnx,tflite or tensorflow to .bolt;

2. Inference: run **[benchmark](/inference/examples/benchmark/benchmark.cpp)** with .bolt and data to get the inference result.
2. Inference: run **[benchmark](inference/examples/benchmark/benchmark.cpp)** with .bolt and data to get the inference result.

For more details about the usage of [**X2bolt**](model_tools/tools/X2bolt/X2bolt.cpp) and [**benchmark**](inference/examples/benchmark/benchmark.cpp) tools, see [docs/USER_HANDBOOK.md](docs/USER_HANDBOOK.md).

# Verified Networks
# DL Applications in Bolt

Here we show some interesting and useful applications in bolt.

| Face Detection | ASR | Semantics Analysis | Image Classification
| :------: | :------: | :------: |:------:
| [![face_detection](docs/images/20_bolt_face_detection.gif)](inference/examples/ultra_face) demo_link: [face detection](inference/examples/ultra_face) | [![asr](docs/images/ChineseSpeechRecognition.gif)]() demo_link: [asr](inference/examples/automatic_speech_recognition) | [![semantics analysis](docs/images/SemanticsAnalysis.gif)]() demo_link: [semantics analysis](kit/Android/Semantics) | [![image_classification](docs/images/ImageClassification.gif)]() demo_link: [image classification](inference/examples/image_classification)
# Verified Networks
---
Bolt has shown its high performance in the inference of common CV and NLP neural networks. Some of the representative networks that we have verified are listed below. You can find detailed benchmark information in [docs/BENCHMARK.md](docs/BENCHMARK.md).

<table border="1" bordercolor="#00CCCC" width="300">
Expand All @@ -75,7 +81,7 @@ Two steps to get started with bolt.
<a href="https://github.com/liuzechun/Bi-Real-net">BiRealNet</a>,
<a href="https://github.com/liuzechun/ReActNet">ReActNet</a>,
<a href="https://github.com/huawei-noah/ghostnet">Ghostnet</a>,
SSD, Yolov3, Pointnet ...
SSD, Yolov3, Pointnet, ViT, TNT ...
</td>
</tr>
<tr>
Expand All @@ -87,6 +93,14 @@ Two steps to get started with bolt.
<a href="docs/USER_HANDBOOK.md#voice-wake-up">Tdnn</a> ...
</td>
</tr>
<tr>
<td>
Recommendation
</td>
<td>
MLP
</td>
</tr>
<tr>
<td>
More DL Tasks
Expand All @@ -100,7 +114,7 @@ Two steps to get started with bolt.
More models than these mentioned above are supported, users are encouraged to further explore.

# Documentations

---
Everything you want to know about bolt is recorded in the detailed documentations stored in [docs](docs).

- [How to install bolt with different compilers](docs/INSTALL.md).
Expand All @@ -112,7 +126,7 @@ Everything you want to know about bolt is recorded in the detailed documentation
- [Frequently Asked Questions(FAQ)](docs/FAQ.md)

# Articles

---
- [深度学习加速库Bolt领跑端侧AI](https://zhuanlan.zhihu.com/p/317111024)
- [为什么 Bolt 这么快:矩阵向量乘的实现](https://zhuanlan.zhihu.com/p/97928435)
- [深入硬件特性加速TinyBert,首次实现手机上Bert 6ms推理](https://zhuanlan.zhihu.com/p/158620259)
Expand All @@ -121,13 +135,17 @@ Everything you want to know about bolt is recorded in the detailed documentation
- [ARM CPU 1-bit推理,走向极致的道路](https://zhuanlan.zhihu.com/p/158161592)

# 教程

---
- 图像分类: [Android Demo](https://zhuanlan.zhihu.com/p/359264809), [iOS Demo](https://zhuanlan.zhihu.com/p/359259766)
- 图像增强: [Android Deme](), [iOS Demo]()
- 情感分类: [Android Demo](https://zhuanlan.zhihu.com/p/414971037)
- 中文语音识别: [Android Demo](https://zhuanlan.zhihu.com/p/414978782), [iOS Demo](https://zhuanlan.zhihu.com/p/414981121)
- 人脸检测: [Android Demo](https://zhuanlan.zhihu.com/p/414975102), [iOS Demo](https://zhuanlan.zhihu.com/p/414971375)

# Acknowledgement

---
Bolt refers to the following projects: [caffe](https://github.com/BVLC/caffe), [onnx](https://github.com/onnx/onnx), [tensorflow](https://github.com/tensorflow/tensorflow), [ncnn](https://github.com/Tencent/ncnn), [mnn](https://github.com/alibaba/MNN), [dabnn](https://github.com/JDAI-CV/dabnn).

# License

---
The MIT License(MIT)
4 changes: 2 additions & 2 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif (BOLT_CONFIGURE_FILE)
project(common)

add_subdirectory(uni)
if (USE_MALI)
if (USE_GPU)
add_subdirectory(gcl)
endif (USE_MALI)
endif (USE_GPU)
add_subdirectory(model_spec)
2 changes: 1 addition & 1 deletion common/cmakes/FindProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (USE_DYNAMIC_LIBRARY)
set(Protobuf_SHARED_LIBRARY ${Protobuf_LIBRARY})
else (USE_DYNAMIC_LIBRARY)
find_library(Protobuf_LIBRARY NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX} HINTS $ENV{Protobuf_ROOT}/lib ${Protobuf_ROOT}/lib)
find_library(Protobuf_SHARED_LIBRARY NAMES protobuf SHARED_HINTS $ENV{Protobuf_ROOT}/lib ${Protobuf_ROOT}/lib)
find_library(Protobuf_SHARED_LIBRARY NAMES protobuf HINTS $ENV{Protobuf_ROOT}/lib ${Protobuf_ROOT}/lib)
endif (USE_DYNAMIC_LIBRARY)

find_program(Protobuf_PROTOC_EXECUTABLE NAMES protoc HINTS $ENV{Protobuf_ROOT}/bin ${Protobuf_ROOT}/bin)
Expand Down
22 changes: 0 additions & 22 deletions common/cmakes/FindTraining.cmake

This file was deleted.

Loading

0 comments on commit f5bf1cf

Please sign in to comment.