Browse Source

fix ctpn crnn compile error

pull/15466/head
yuzhenhua 5 years ago
parent
commit
acc8fa5391
7 changed files with 23 additions and 11 deletions
  1. +2
    -1
      model_zoo/official/cv/crnn/ascend310_infer/src/main.cc
  2. +1
    -1
      model_zoo/official/cv/crnn/postprocess.py
  3. +1
    -1
      model_zoo/official/cv/ctpn/ascend310_infer/src/main.cc
  4. +1
    -1
      model_zoo/official/cv/faster_rcnn/scripts/run_infer_310.sh
  5. +1
    -1
      model_zoo/official/cv/maskrcnn/scripts/run_infer_310.sh
  6. +16
    -5
      model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt
  7. +1
    -1
      model_zoo/official/recommend/naml/script/run_infer_310.sh

+ 2
- 1
model_zoo/official/cv/crnn/ascend310_infer/src/main.cc View File

@@ -43,6 +43,7 @@ using mindspore::Graph;
using mindspore::GraphCell;
using mindspore::kSuccess;
using mindspore::MSTensor;
using mindspore::DataType;
using mindspore::dataset::Execute;
using mindspore::dataset::vision::Decode;
using mindspore::dataset::vision::Resize;
@@ -98,7 +99,7 @@ int main(int argc, char **argv) {
std::shared_ptr<Normalize>(new Normalize({127.5, 127.5, 127.5},
{127.5, 127.5, 127.5})),
std::shared_ptr<HWC2CHW>(new HWC2CHW())});
Execute composeCast(std::shared_ptr<TypeCast>(new TypeCast("float16")));
Execute composeCast(std::shared_ptr<TypeCast>(new TypeCast(DataType::kNumberTypeFloat16)));

struct timeval start;
struct timeval end;


+ 1
- 1
model_zoo/official/cv/crnn/postprocess.py View File

@@ -74,7 +74,7 @@ def get_eval_result(result_path, ann_file):

for img_name, label in ann.items():
result_file = os.path.join(result_path, img_name[:-4] + "_0.bin")
pred_y = np.fromfile(result_file, dtype=np.float32).reshape(config.num_step, -1, config.class_num)
pred_y = np.fromfile(result_file, dtype=np.float16).reshape(config.num_step, -1, config.class_num)
metrics.update(pred_y, [label])

print("result CRNNAccuracy is: ", metrics.eval())


+ 1
- 1
model_zoo/official/cv/ctpn/ascend310_infer/src/main.cc View File

@@ -103,7 +103,7 @@ int main(int argc, char **argv) {
std::shared_ptr<TensorTransform> resize(new Resize({576, 960}));
std::shared_ptr<TensorTransform> normalize(new Normalize({123.675, 116.28, 103.53}, {58.395, 57.12, 57.375}));
std::shared_ptr<TensorTransform> hwc2chw(new HWC2CHW());
std::shared_ptr<TensorTransform> typeCast(new TypeCast("float16"));
std::shared_ptr<TensorTransform> typeCast(new TypeCast(DataType::kNumberTypeFloat16));

mindspore::dataset::Execute transformDecode(decode);
mindspore::dataset::Execute transform({resize, normalize, hwc2chw});


+ 1
- 1
model_zoo/official/cv/faster_rcnn/scripts/run_infer_310.sh View File

@@ -49,7 +49,7 @@ echo $device_id
export ASCEND_HOME=/usr/local/Ascend/
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
export PATH=$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:$ASCEND_HOME/ascend-toolkit/latest/atc/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/acllib/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
export TBE_IMPL_PATH=${ASCEND_HOME}/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe
export PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp


+ 1
- 1
model_zoo/official/cv/maskrcnn/scripts/run_infer_310.sh View File

@@ -48,7 +48,7 @@ echo $device_id
export ASCEND_HOME=/usr/local/Ascend/
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
export PATH=$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:$ASCEND_HOME/ascend-toolkit/latest/atc/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/acllib/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
export TBE_IMPL_PATH=${ASCEND_HOME}/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe
export PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp


+ 16
- 5
model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt View File

@@ -49,16 +49,27 @@ link_directories(
${LIB_PATH}
)

# Set output directory
set(PROJECT_SRC_ROOT ${CMAKE_CURRENT_LIST_DIR}/)

# Set include directory and library directory
set(ACL_LIB_DIR $ENV{ASCEND_HOME}/acllib)
set(ATLAS_ACL_LIB_DIR $ENV{ASCEND_HOME}/ascend-toolkit/latest/acllib)
# Header path
include_directories(${ACL_LIB_DIR}/include/)
include_directories(${ATLAS_ACL_LIB_DIR}/include/)
include_directories(${PROJECT_SRC_ROOT}/../inc)

# add host lib path
link_directories(${ACL_LIB_DIR})
find_library(acl libascendcl.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)

add_executable(main
./src/utils.cpp
./src/model_process.cpp
./src/sample_process.cpp
./src/main.cpp)

if(target STREQUAL "Simulator_Function")
target_link_libraries(main funcsim)
else()
target_link_libraries(main ascendcl stdc++ gflags)
endif()
target_link_libraries(main ${acl} stdc++ gflags)

install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

+ 1
- 1
model_zoo/official/recommend/naml/script/run_infer_310.sh View File

@@ -59,7 +59,7 @@ echo $device_id
export ASCEND_HOME=/usr/local/Ascend/
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
export PATH=$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:$ASCEND_HOME/ascend-toolkit/latest/atc/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ons:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/acllib/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ons:$LD_LIBRARY_PATH
export TBE_IMPL_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe
export PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp


Loading…
Cancel
Save