update ascend310 infer of ssd

pull/12742/head
chenhaozhe 4 years ago
parent b16fcc8037
commit 1bd802aa32

@ -6,9 +6,9 @@ set(PROJECT_SRC_ROOT ${CMAKE_CURRENT_LIST_DIR}/)
option(MINDSPORE_PATH "mindspore install path" "") option(MINDSPORE_PATH "mindspore install path" "")
include_directories(${MINDSPORE_PATH}) include_directories(${MINDSPORE_PATH})
include_directories(${MINDSPORE_PATH}/include) include_directories(${MINDSPORE_PATH}/include)
include_directories(${PROJECT_SRC_ROOT}/../inc) include_directories(${PROJECT_SRC_ROOT})
find_library(MS_LIB libmindspore.so ${MINDSPORE_PATH}/lib) find_library(MS_LIB libmindspore.so ${MINDSPORE_PATH}/lib)
file(GLOB_RECURSE MD_LIB ${MINDSPORE_PATH}/_c_dataengine*) file(GLOB_RECURSE MD_LIB ${MINDSPORE_PATH}/_c_dataengine*)
add_executable(main main.cc utils.cc) add_executable(main src/main.cc src/utils.cc)
target_link_libraries(main ${MS_LIB} ${MD_LIB} gflags) target_link_libraries(main ${MS_LIB} ${MD_LIB} gflags)

@ -13,6 +13,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ ! -d out ]; then
mkdir out
fi
cmake . -DMINDSPORE_PATH="`pip3.7 show mindspore-ascend | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`" cd out
if [ -f "Makefile" ]; then
make clean
fi
cmake .. \
-DMINDSPORE_PATH="`pip3.7 show mindspore-ascend | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`"
make make

@ -27,10 +27,10 @@
#include "include/api/context.h" #include "include/api/context.h"
#include "include/api/types.h" #include "include/api/types.h"
#include "include/api/serialization.h" #include "include/api/serialization.h"
#include "include/minddata/dataset/include/vision.h" #include "include/minddata/dataset/include/vision_ascend.h"
#include "include/minddata/dataset/include/execute.h" #include "include/minddata/dataset/include/execute.h"
#include "../inc/utils.h" #include "inc/utils.h"
using mindspore::GlobalContext; using mindspore::GlobalContext;
using mindspore::Serialization; using mindspore::Serialization;
@ -42,7 +42,7 @@ using mindspore::GraphCell;
using mindspore::kSuccess; using mindspore::kSuccess;
using mindspore::MSTensor; using mindspore::MSTensor;
using mindspore::dataset::Execute; using mindspore::dataset::Execute;
using mindspore::dataset::vision::DvppDecodeResizeCropJpeg; using mindspore::dataset::vision::DvppDecodeResizeJpeg;
DEFINE_string(mindir_path, "", "mindir path"); DEFINE_string(mindir_path, "", "mindir path");
@ -84,7 +84,7 @@ int main(int argc, char **argv) {
std::map<double, double> costTime_map; std::map<double, double> costTime_map;
size_t size = all_files.size(); size_t size = all_files.size();
Execute resize_op(DvppDecodeResizeCropJpeg({640, 640}, {640, 640})); Execute resize_op(std::shared_ptr<DvppDecodeResizeJpeg>(new DvppDecodeResizeJpeg({640, 640})));
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
struct timeval start = {0}; struct timeval start = {0};
struct timeval end = {0}; struct timeval end = {0};

@ -17,7 +17,7 @@
#include <fstream> #include <fstream>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include "../inc/utils.h" #include "inc/utils.h"
using mindspore::MSTensor; using mindspore::MSTensor;
using mindspore::DataType; using mindspore::DataType;

@ -55,7 +55,7 @@ fi
function compile_app() function compile_app()
{ {
cd ../ascend310_infer/src cd ../ascend310_infer
if [ -f "Makefile" ]; then if [ -f "Makefile" ]; then
make clean make clean
fi fi
@ -73,7 +73,7 @@ function infer()
fi fi
mkdir result_Files mkdir result_Files
mkdir time_Result mkdir time_Result
../ascend310_infer/src/main --mindir_path=$model --dataset_path=$data_path --device_id=$device_id --aipp_path ../src/aipp.cfg &> infer.log ../ascend310_infer/out/main --mindir_path=$model --dataset_path=$data_path --device_id=$device_id --aipp_path ../src/aipp.cfg &> infer.log
} }
function cal_acc() function cal_acc()

Loading…
Cancel
Save