提交 daf7df12 编写于 作者: R Ruilong Liu 提交者: GitHub

Merge branch 'develop' into develop

...@@ -140,8 +140,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build) ...@@ -140,8 +140,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)
# NET default # NET default
set(NET "defult" CACHE STRING "select net type") set(NET "default" CACHE STRING "select net type")
set_property(CACHE NET PROPERTY STRINGS "defult" "googlenet" "mobilenet" "yolo" "squeezenet" "FPGAnets") set_property(CACHE NET PROPERTY STRINGS "default" "googlenet" "mobilenet" "yolo" "squeezenet" "FPGAnets")
include("${CMAKE_CURRENT_LIST_DIR}/tools/op.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tools/op.cmake")
......
#!/usr/bin/env bash #!/usr/bin/env bash
NETS=""
declare -a supportedNets=("googlenet" "mobilenet" "yolo" "squeezenet" "resnet")
build_for_mac() { build_for_mac() {
if [ ! `which brew` ]; then if [ ! `which brew` ]; then
...@@ -60,7 +62,8 @@ build_for_android() { ...@@ -60,7 +62,8 @@ build_for_android() {
ANDROID_PLATFORM_VERSION="android-22" ANDROID_PLATFORM_VERSION="android-22"
TOOLCHAIN_FILE="./tools/android-cmake/android.toolchain.cmake" TOOLCHAIN_FILE="./tools/android-cmake/android.toolchain.cmake"
ANDROID_ARM_MODE="arm" ANDROID_ARM_MODE="arm"
if [ $# -eq 1 ]; then
if [ "${#NETS}" > 1 ]; then
cmake .. \ cmake .. \
-B"../build/release/${PLATFORM}" \ -B"../build/release/${PLATFORM}" \
-DANDROID_ABI="${ABI}" \ -DANDROID_ABI="${ABI}" \
...@@ -70,7 +73,7 @@ build_for_android() { ...@@ -70,7 +73,7 @@ build_for_android() {
-DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \ -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \
-DANDROID_STL=c++_static \ -DANDROID_STL=c++_static \
-DANDROID=true \ -DANDROID=true \
-DNET=$1 \ -DNET="${NETS}" \
-D"${ARM_PLATFORM}"=true -D"${ARM_PLATFORM}"=true
else else
...@@ -96,14 +99,14 @@ build_for_ios() { ...@@ -96,14 +99,14 @@ build_for_ios() {
BUILD_DIR=../build/release/"${PLATFORM}"/ BUILD_DIR=../build/release/"${PLATFORM}"/
TOOLCHAIN_FILE="./tools/ios-cmake/ios.toolchain.cmake" TOOLCHAIN_FILE="./tools/ios-cmake/ios.toolchain.cmake"
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
if [ $# -eq 1 ]; then if [ "${#NETS}" > 1 ]; then
cmake .. \ cmake .. \
-B"${BUILD_DIR}" \ -B"${BUILD_DIR}" \
-DCMAKE_BUILD_TYPE="${MODE}" \ -DCMAKE_BUILD_TYPE="${MODE}" \
-DIOS_PLATFORM=OS \ -DIOS_PLATFORM=OS \
-DIOS_ARCH="${IOS_ARCH}" \ -DIOS_ARCH="${IOS_ARCH}" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \ -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
-DNET=$1 \ -DNET="${NETS}" \
-DIS_IOS="true" -DIS_IOS="true"
else else
cmake .. \ cmake .. \
...@@ -123,7 +126,7 @@ build_for_ios() { ...@@ -123,7 +126,7 @@ build_for_ios() {
} }
build_error() { build_error() {
echo "unknown argument" echo "unknown target : $1"
} }
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
...@@ -131,31 +134,37 @@ if [ $# -lt 1 ]; then ...@@ -131,31 +134,37 @@ if [ $# -lt 1 ]; then
echo "available targets: ios|android" echo "available targets: ios|android"
echo "sample usage: ./build.sh android" echo "sample usage: ./build.sh android"
else else
if [ $# -eq 2 ]; then params=($@)
if [ $2 != "googlenet" -a $2 != "mobilenet" -a $2 != "yolo" -a $2 != "squeezenet" -a $2 != "resnet" ]; then for(( i=1; i<$#; i++ )); do
if [ $1 = "android" ]; then if [ ${i} != 1 ]; then
build_for_android NETS=$NETS$";"
elif [ $1 = "ios" ]; then fi
build_for_ios NETS=$NETS$"${params[i]}"
else done
build_error params=${@:2}
fi
else supported=false
if [ $1 = "android" ]; then for name in ${params[@]}; do
build_for_android $2 for net in ${supportedNets[@]}; do
elif [ $1 = "ios" ]; then match=false
build_for_ios $2 if [ "$name"x = "$net"x ];then
else supported=true
build_error match=true
fi break 1
fi
done
if [ "$match" = false ];then
echo "${name} not supported!"
echo "supported nets are: ${supportedNets[@]}"
exit -1
fi fi
done
if [ $1 = "android" ]; then
build_for_android
elif [ $1 = "ios" ]; then
build_for_ios
else else
if [ $1 = "android" ]; then build_error "$1"
build_for_android fi
elif [ $1 = "ios" ]; then
build_for_ios
else
build_error
fi
fi
fi fi
\ No newline at end of file
if (NET STREQUAL "googlenet") set(FOUND_MATCH OFF)
if ("googlenet" IN_LIST NET)
message("googlenet enabled")
set(CONCAT_OP ON) set(CONCAT_OP ON)
set(CONV_OP ON) set(CONV_OP ON)
set(LRN_OP ON) set(LRN_OP ON)
...@@ -9,7 +11,12 @@ if (NET STREQUAL "googlenet") ...@@ -9,7 +11,12 @@ if (NET STREQUAL "googlenet")
set(RELU_OP ON) set(RELU_OP ON)
set(FUSION_CONVADD_OP ON) set(FUSION_CONVADD_OP ON)
set(FUSION_CONVADD_RELU_OP ON) set(FUSION_CONVADD_RELU_OP ON)
elseif (NET STREQUAL "mobilenet")
set(FOUND_MATCH ON)
endif()
if ("mobilenet" IN_LIST NET)
message("mobilenet enabled")
set(CONV_OP ON) set(CONV_OP ON)
set(ELEMENTWISEADD_OP ON) set(ELEMENTWISEADD_OP ON)
set(RELU_OP ON) set(RELU_OP ON)
...@@ -21,12 +28,23 @@ elseif (NET STREQUAL "mobilenet") ...@@ -21,12 +28,23 @@ elseif (NET STREQUAL "mobilenet")
set(RESHAPE_OP ON) set(RESHAPE_OP ON)
set(FUSION_CONVADDBNRELU_OP ON) set(FUSION_CONVADDBNRELU_OP ON)
set(FUSION_CONVADD_OP ON) set(FUSION_CONVADD_OP ON)
elseif (NET STREQUAL "yolo")
set(FOUND_MATCH ON)
endif()
if ("yolo" IN_LIST NET)
message("yolo enabled")
set(BATCHNORM_OP ON) set(BATCHNORM_OP ON)
set(CONV_OP ON) set(CONV_OP ON)
set(RELU_OP ON) set(RELU_OP ON)
set(ELEMENTWISEADD_OP ON) set(ELEMENTWISEADD_OP ON)
elseif (NET STREQUAL "squeezenet")
set(FOUND_MATCH ON)
endif()
if ("squeezenet" IN_LIST NET)
message("squeezenet enabled")
set(CONCAT_OP ON) set(CONCAT_OP ON)
set(CONV_OP ON) set(CONV_OP ON)
set(RELU_OP ON) set(RELU_OP ON)
...@@ -34,15 +52,26 @@ elseif (NET STREQUAL "squeezenet") ...@@ -34,15 +52,26 @@ elseif (NET STREQUAL "squeezenet")
set(POOL_OP ON) set(POOL_OP ON)
set(RESHAPE_OP ON) set(RESHAPE_OP ON)
set(SOFTMAX_OP ON) set(SOFTMAX_OP ON)
elseif (NET STREQUAL "resnet")
set(FOUND_MATCH ON)
endif()
if ("resnet" IN_LIST NET)
message("resnet enabled")
set(CONCAT_OP ON)
set(CONV_OP ON) set(CONV_OP ON)
set(BATCHNORM_OP ON) set(RELU_OP ON)
set(ELEMENTWISEADD_OP ON) set(ELEMENTWISEADD_OP ON)
set(SOFTMAX_OP ON)
set(MUL_OP ON)
set(POOL_OP ON) set(POOL_OP ON)
set(RELU_OP ON) set(RESHAPE_OP ON)
elseif (NET STREQUAL "FPGAnets") set(SOFTMAX_OP ON)
set(FOUND_MATCH ON)
endif()
if ("FPGAnets" IN_LIST NET)
message("FPGAnets enabled")
set(FUSION_CONVRELU_OP ON) set(FUSION_CONVRELU_OP ON)
set(FUSION_CONVBNSCALE_OP ON) set(FUSION_CONVBNSCALE_OP ON)
set(FUSION_CONVBNSCALERELU_OP ON) set(FUSION_CONVBNSCALERELU_OP ON)
...@@ -51,8 +80,14 @@ elseif (NET STREQUAL "FPGAnets") ...@@ -51,8 +80,14 @@ elseif (NET STREQUAL "FPGAnets")
set(REGION_OP ON) set(REGION_OP ON)
set(POOL_OP ON) set(POOL_OP ON)
set(CONCAT_OP ON) set(CONCAT_OP ON)
set(SOFTMAX_OP ON) set(SOFTMAX_OP ON)
else ()
set(FOUND_MATCH ON)
endif()
if(NOT FOUND_MATCH)
message("--default--")
set(BATCHNORM_OP ON) set(BATCHNORM_OP ON)
set(BOXCODER_OP ON) set(BOXCODER_OP ON)
set(CONCAT_OP ON) set(CONCAT_OP ON)
...@@ -82,6 +117,8 @@ else () ...@@ -82,6 +117,8 @@ else ()
set(SLICE_OP ON) set(SLICE_OP ON)
set(DROPOUT_OP ON) set(DROPOUT_OP ON)
set(IM2SEQUENCE_OP ON) set(IM2SEQUENCE_OP ON)
endif()
# option(BATCHNORM_OP "" ON) # option(BATCHNORM_OP "" ON)
# option(BOXCODER_OP "" ON) # option(BOXCODER_OP "" ON)
# option(CONCAT_OP "" ON) # option(CONCAT_OP "" ON)
...@@ -102,7 +139,7 @@ else () ...@@ -102,7 +139,7 @@ else ()
# option(SOFTMAX_OP "" ON) # option(SOFTMAX_OP "" ON)
# option(TRANSPOSE_OP "" ON) # option(TRANSPOSE_OP "" ON)
# option(FUSION_CONVADD_RELU_OP "" ON) # option(FUSION_CONVADD_RELU_OP "" ON)
endif () # endif ()
if (BATCHNORM_OP) if (BATCHNORM_OP)
add_definitions(-DBATCHNORM_OP) add_definitions(-DBATCHNORM_OP)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册