parent
a7c1ed123c
commit
6313bdc35f
@ -1,59 +0,0 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
option(WITH_INFERENCE_DEMO "Compile with Inference demo" OFF)
|
||||
if(NOT WITH_INFERENCE_DEMO)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(DEMO_INSTALL_DIR "${PADDLE_BINARY_DIR}/inference_demo")
|
||||
set(URL_ROOT http://paddlemodels.bj.bcebos.com/inference-vis-demos%2F)
|
||||
|
||||
function(inference_download_test_demo TARGET)
|
||||
if (NOT WITH_TESTING)
|
||||
return()
|
||||
endif()
|
||||
set(options "")
|
||||
set(oneValueArgs URL)
|
||||
set(multiValueArgs SRCS)
|
||||
cmake_parse_arguments(tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(test_dir "${DEMO_INSTALL_DIR}/${TARGET}")
|
||||
message(STATUS "inference demo ${test_dir}")
|
||||
|
||||
if(NOT EXISTS "${test_dir}")
|
||||
message(STATUS "Download ${TARGET} model from ${tests_URL}")
|
||||
execute_process(COMMAND bash -c "mkdir -p ${test_dir}")
|
||||
execute_process(COMMAND bash -c "cd ${test_dir}; wget -q ${tests_URL}")
|
||||
execute_process(COMMAND bash -c "cd ${test_dir}; tar xzf *.tar.gz")
|
||||
endif()
|
||||
|
||||
cc_test(${TARGET} SRCS "${tests_SRCS}"
|
||||
DEPS paddle_inference_api paddle_fluid
|
||||
ARGS --data=${test_dir}/data.txt
|
||||
--modeldir=${test_dir}/model
|
||||
--refer=${test_dir}/result.txt)
|
||||
endfunction()
|
||||
|
||||
# disable mobilenet test
|
||||
#inference_download_test_demo(mobilenet_inference_demo
|
||||
# SRCS vis_demo.cc
|
||||
# URL ${URL_ROOT}mobilenet.tar.gz)
|
||||
inference_download_test_demo(se_resnext50_inference_demo
|
||||
SRCS vis_demo.cc
|
||||
URL ${URL_ROOT}se_resnext50.tar.gz)
|
||||
inference_download_test_demo(ocr_inference_demo
|
||||
SRCS vis_demo.cc
|
||||
URL ${URL_ROOT}ocr.tar.gz)
|
@ -1,36 +0,0 @@
|
||||
# Infernce Demos
|
||||
|
||||
Input data format:
|
||||
|
||||
- Each line contains a single record
|
||||
- Each record's format is
|
||||
|
||||
```
|
||||
<space splitted floats as data>\t<space splitted ints as shape>
|
||||
```
|
||||
|
||||
Follow the C++ codes in `vis_demo.cc`.
|
||||
|
||||
## MobileNet
|
||||
|
||||
To execute the demo, simply run
|
||||
|
||||
```sh
|
||||
./mobilenet_inference_demo --modeldir <model> --data <datafile>
|
||||
```
|
||||
|
||||
## SE-ResNeXt-50
|
||||
|
||||
To execute the demo, simply run
|
||||
|
||||
```sh
|
||||
./se_resnext50_inference_demo --modeldir <model> --data <datafile>
|
||||
```
|
||||
|
||||
## OCR
|
||||
|
||||
To execute the demo, simply run
|
||||
|
||||
```sh
|
||||
./ocr_inference_demo --modeldir <model> --data <datafile>
|
||||
```
|
@ -0,0 +1 @@
|
||||
data
|
@ -0,0 +1,26 @@
|
||||
# Inference Demos
|
||||
|
||||
There are several demos:
|
||||
|
||||
- simple_on_word2vec:
|
||||
- Follow the C++ codes is in `simple_on_word2vec.cc`.
|
||||
- It is suitable for word2vec model.
|
||||
- vis_demo:
|
||||
- Follow the C++ codes is in `vis_demo.cc`.
|
||||
- It is suitable for mobilenet, se_resnext50 and ocr three models.
|
||||
- Input data format:
|
||||
- Each line contains a single record
|
||||
- Each record's format is
|
||||
```
|
||||
<space splitted floats as data>\t<space splitted ints as shape>
|
||||
```
|
||||
|
||||
To build and execute the demos, simply run
|
||||
```
|
||||
./run.sh $PADDLE_ROOT $TURN_ON_MKL $TEST_GPU_CPU
|
||||
```
|
||||
- It will build and execute the demos in both static and shared library.
|
||||
- `$PADDLE_ROOT`: paddle library path
|
||||
- `$TURN_ON_MKL`: use MKL or Openblas
|
||||
- `$TEST_GPU_CPU`: test both GPU/CPU mode or only CPU mode
|
||||
- NOTE: for simple_on_word2vec, must run `ctest -R test_word2vec -R` to obtain word2vec model at first.
|
Loading…
Reference in new issue