!15466 fix crnn and ctpn 310 compile error
From: @yuzhenhua666 Reviewed-by: @c_34,@wuxuejian Signed-off-by: @c_34
This commit is contained in:
commit
8e5c74d691
|
@ -43,6 +43,7 @@ using mindspore::Graph;
|
||||||
using mindspore::GraphCell;
|
using mindspore::GraphCell;
|
||||||
using mindspore::kSuccess;
|
using mindspore::kSuccess;
|
||||||
using mindspore::MSTensor;
|
using mindspore::MSTensor;
|
||||||
|
using mindspore::DataType;
|
||||||
using mindspore::dataset::Execute;
|
using mindspore::dataset::Execute;
|
||||||
using mindspore::dataset::vision::Decode;
|
using mindspore::dataset::vision::Decode;
|
||||||
using mindspore::dataset::vision::Resize;
|
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},
|
std::shared_ptr<Normalize>(new Normalize({127.5, 127.5, 127.5},
|
||||||
{127.5, 127.5, 127.5})),
|
{127.5, 127.5, 127.5})),
|
||||||
std::shared_ptr<HWC2CHW>(new HWC2CHW())});
|
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 start;
|
||||||
struct timeval end;
|
struct timeval end;
|
||||||
|
|
|
@ -74,7 +74,7 @@ def get_eval_result(result_path, ann_file):
|
||||||
|
|
||||||
for img_name, label in ann.items():
|
for img_name, label in ann.items():
|
||||||
result_file = os.path.join(result_path, img_name[:-4] + "_0.bin")
|
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])
|
metrics.update(pred_y, [label])
|
||||||
|
|
||||||
print("result CRNNAccuracy is: ", metrics.eval())
|
print("result CRNNAccuracy is: ", metrics.eval())
|
||||||
|
|
|
@ -103,7 +103,7 @@ int main(int argc, char **argv) {
|
||||||
std::shared_ptr<TensorTransform> resize(new Resize({576, 960}));
|
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> 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> 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 transformDecode(decode);
|
||||||
mindspore::dataset::Execute transform({resize, normalize, hwc2chw});
|
mindspore::dataset::Execute transform({resize, normalize, hwc2chw});
|
||||||
|
|
|
@ -49,7 +49,7 @@ echo $device_id
|
||||||
export ASCEND_HOME=/usr/local/Ascend/
|
export ASCEND_HOME=/usr/local/Ascend/
|
||||||
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
|
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 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 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 PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
|
||||||
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
||||||
|
|
|
@ -48,7 +48,7 @@ echo $device_id
|
||||||
export ASCEND_HOME=/usr/local/Ascend/
|
export ASCEND_HOME=/usr/local/Ascend/
|
||||||
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
|
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 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 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 PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
|
||||||
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
||||||
|
|
|
@ -49,16 +49,27 @@ link_directories(
|
||||||
${LIB_PATH}
|
${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
|
add_executable(main
|
||||||
./src/utils.cpp
|
./src/utils.cpp
|
||||||
./src/model_process.cpp
|
./src/model_process.cpp
|
||||||
./src/sample_process.cpp
|
./src/sample_process.cpp
|
||||||
./src/main.cpp)
|
./src/main.cpp)
|
||||||
|
|
||||||
if(target STREQUAL "Simulator_Function")
|
target_link_libraries(main ${acl} stdc++ gflags)
|
||||||
target_link_libraries(main funcsim)
|
|
||||||
else()
|
|
||||||
target_link_libraries(main ascendcl stdc++ gflags)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
|
|
@ -59,7 +59,7 @@ echo $device_id
|
||||||
export ASCEND_HOME=/usr/local/Ascend/
|
export ASCEND_HOME=/usr/local/Ascend/
|
||||||
if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then
|
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 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 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 PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH
|
||||||
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp
|
||||||
|
|
Loading…
Reference in New Issue