From 75bf124dd1f696068eb3a5c8a34976315f525a32 Mon Sep 17 00:00:00 2001 From: qnqinan Date: Wed, 21 Nov 2018 18:15:18 +0800 Subject: [PATCH] add densebox test file --- CMakeLists.txt | 2 +- src/fpga/V2/pe.cpp | 2 +- test/CMakeLists.txt | 6 ++++ test/fpga/test_densebox_combine.cpp | 49 +++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 test/fpga/test_densebox_combine.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f1cffd332..bbf2be8fd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,7 +213,7 @@ else() set(NET "default" CACHE STRING "select net type") endif() -set_property(CACHE NET PROPERTY STRINGS "default" "googlenet" "mobilenet" "yolo" "squeezenet" "FPGAnets" "NLP") +set_property(CACHE NET PROPERTY STRINGS "default" "googlenet" "mobilenet" "yolo" "squeezenet" "FPGA_NET_V1" "FPGA_NET_V2" "NLP") include("${CMAKE_CURRENT_LIST_DIR}/tools/op.cmake") diff --git a/src/fpga/V2/pe.cpp b/src/fpga/V2/pe.cpp index 5a1114cd5e..35ef06de2d 100644 --- a/src/fpga/V2/pe.cpp +++ b/src/fpga/V2/pe.cpp @@ -213,7 +213,7 @@ int PerformBypass(const struct BypassArgs &args) { // args.output.scale_address[0] = (float)(1.0 / scale); // NOLINT // args.output.scale_address[1] = scale; // } - return ret; + // return ret; } int ComputeFPGAConcat(const struct ConcatArgs &args) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a4a8e7e21..edd63a7c68 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -67,6 +67,9 @@ if (CON GREATER -1) ADD_EXECUTABLE(test-resnet50 fpga/test_resnet50.cpp test_helper.h test_include.h executor_for_test.h) target_link_libraries(test-resnet50 paddle-mobile) + ADD_EXECUTABLE(test-densebox fpga/test_densebox_combine.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-densebox paddle-mobile) + set(FOUND_MATCH ON) endif () @@ -78,6 +81,9 @@ if (CON GREATER -1) ADD_EXECUTABLE(test-pe fpga/test_pe.cpp) target_link_libraries(test-pe paddle-mobile) + ADD_EXECUTABLE(test-densebox fpga/test_densebox_combine.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-densebox paddle-mobile) + set(FOUND_MATCH ON) endif () diff --git a/test/fpga/test_densebox_combine.cpp b/test/fpga/test_densebox_combine.cpp new file mode 100644 index 0000000000..2d25270a85 --- /dev/null +++ b/test/fpga/test_densebox_combine.cpp @@ -0,0 +1,49 @@ +/* Copyright (c) 2018 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. */ + +#include +#include "../test_helper.h" +#include "../test_include.h" + +#ifdef PADDLE_MOBILE_FPGA_V1 +#include "fpga/V1/api.h" +#endif +#ifdef PADDLE_MOBILE_FPGA_V2 +#include "fpga/V2/api.h" +#endif + +static const char *g_densebox_combine = "../models/densebox"; +int main() { + paddle_mobile::fpga::open_device(); + paddle_mobile::PaddleMobile paddle_mobile; + //paddle_mobile.SetThreadNum(4); + if (paddle_mobile.Load(std::string(g_densebox_combine) + "/model", + std::string(g_densebox_combine) + "/params", true)) { + //std::vector input; + //std::vector dims{1, 3, 512, 1024}; + //GetInput(g_test_image_1x3x224x224_banana, &input, dims); + + //auto vec_result = paddle_mobile.Predict(input, dims); + + Tensor input_tensor; + SetupTensor(&input_tensor, {1, 3, 512, 1024}, static_cast(0), + static_cast(1)); + //readStream(g_image_src_float, + // input_tensor.mutable_data({1, 3, 224, 224})); + paddle_mobile.FeedData(input_tensor); + paddle_mobile.Predict_To(-1); + } + + return 0; +} -- GitLab