mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
[Bug Fix] Fix bugs in release task scripts (#560)
* Fix release_task cpp_run.sh Author: felixhjh <852142024@qq.com> Date: Thu Nov 10 07:26:48 2022 +0000 * Add option for infer_ppyoloe.cc author: felixhjh <852142024@qq.com> * Fix bug in release task scripts
This commit is contained in:
@@ -40,7 +40,7 @@ def all_sort(x):
|
|||||||
y = np.split(x1, len(x1))
|
y = np.split(x1, len(x1))
|
||||||
z = list(reversed(y))
|
z = list(reversed(y))
|
||||||
index = np.lexsort(z)
|
index = np.lexsort(z)
|
||||||
return x[index]
|
return np.squeeze(x[index])
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
@@ -91,8 +91,8 @@ def write2file(error_file):
|
|||||||
with open(error_file, "a+") as f:
|
with open(error_file, "a+") as f:
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
py_version = python_version()
|
py_version = python_version()
|
||||||
f.write(args.platform + " " + py_version + " " + args.result_path.split(
|
f.write(args.platform + " " + py_version + " " +
|
||||||
".")[0] + "\n")
|
args.result_path.split(".")[0] + "\n")
|
||||||
|
|
||||||
|
|
||||||
def save_numpy_result(file_path, error_msg):
|
def save_numpy_result(file_path, error_msg):
|
||||||
@@ -108,29 +108,37 @@ def check_result(gt_result, infer_result, args):
|
|||||||
score_diff = diff[:, -2]
|
score_diff = diff[:, -2]
|
||||||
boxes_diff = diff[:, :-2]
|
boxes_diff = diff[:, :-2]
|
||||||
boxes_diff_ratio = boxes_diff / (infer_result[:, :-2] + 1e-6)
|
boxes_diff_ratio = boxes_diff / (infer_result[:, :-2] + 1e-6)
|
||||||
|
label_diff_threshold = diff_score_threshold[platform]["label_diff"]
|
||||||
|
score_diff_threshold = diff_score_threshold[platform]["score_diff"]
|
||||||
|
boxes_diff_threshold = diff_score_threshold[platform]["boxes_diff"]
|
||||||
|
boxes_diff_ratio_threshold = diff_score_threshold[platform][
|
||||||
|
"boxes_diff_ratio"]
|
||||||
is_diff = False
|
is_diff = False
|
||||||
backend = args.result_path.split(".")[0]
|
backend = args.result_path.split(".")[0]
|
||||||
if (label_diff > diff_score_threshold[platform]["label_diff"]).any():
|
if (label_diff > label_diff_threshold).any():
|
||||||
print(args.platform, args.device, "label diff ", label_diff)
|
print(args.platform, args.device, "label diff ", label_diff)
|
||||||
is_diff = True
|
is_diff = True
|
||||||
label_diff_bool_file = args.platform + "_" + backend + "_" + "label_diff_bool.txt"
|
label_diff_bool_file = args.platform + "_" + backend + "_" + "label_diff_bool.txt"
|
||||||
save_numpy_result(label_diff_bool_file, label_diff > 0)
|
save_numpy_result(label_diff_bool_file,
|
||||||
if (score_diff > diff_score_threshold[platform]["score_diff"]).any():
|
label_diff > label_diff_threshold)
|
||||||
|
if (score_diff > score_diff_threshold).any():
|
||||||
print(args.platform, args.device, "score diff ", score_diff)
|
print(args.platform, args.device, "score diff ", score_diff)
|
||||||
is_diff = True
|
is_diff = True
|
||||||
score_diff_bool_file = args.platform + "_" + backend + "_" + "score_diff_bool.txt"
|
score_diff_bool_file = args.platform + "_" + backend + "_" + "score_diff_bool.txt"
|
||||||
save_numpy_result(score_diff_bool_file, score_diff > 1e-4)
|
save_numpy_result(score_diff_bool_file,
|
||||||
if (boxes_diff_ratio > diff_score_threshold[platform]["boxes_diff_ratio"]
|
score_diff > score_diff_threshold)
|
||||||
).any() and (
|
if (boxes_diff_ratio > boxes_diff_ratio_threshold).any() and (
|
||||||
boxes_diff > diff_score_threshold[platform]["boxes_diff"]).any():
|
boxes_diff > boxes_diff_threshold).any():
|
||||||
print(args.platform, args.device, "boxes diff ", boxes_diff_ratio)
|
print(args.platform, args.device, "boxes diff ", boxes_diff_ratio)
|
||||||
is_diff = True
|
is_diff = True
|
||||||
boxes_diff_bool_file = args.platform + "_" + backend + "_" + "boxes_diff_bool.txt"
|
boxes_diff_bool_file = args.platform + "_" + backend + "_" + "boxes_diff_bool.txt"
|
||||||
boxes_diff_ratio_file = args.platform + "_" + backend + "_" + "boxes_diff_ratio.txt"
|
boxes_diff_ratio_file = args.platform + "_" + backend + "_" + "boxes_diff_ratio.txt"
|
||||||
boxes_diff_ratio_bool_file = args.platform + "_" + backend + "_" + "boxes_diff_ratio_bool"
|
boxes_diff_ratio_bool_file = args.platform + "_" + backend + "_" + "boxes_diff_ratio_bool"
|
||||||
save_numpy_result(boxes_diff_bool_file, boxes_diff > 1e-3)
|
save_numpy_result(boxes_diff_bool_file,
|
||||||
|
boxes_diff > boxes_diff_threshold)
|
||||||
save_numpy_result(boxes_diff_ratio_file, boxes_diff_ratio)
|
save_numpy_result(boxes_diff_ratio_file, boxes_diff_ratio)
|
||||||
save_numpy_result(boxes_diff_ratio_bool_file, boxes_diff_ratio > 1e-4)
|
save_numpy_result(boxes_diff_ratio_bool_file,
|
||||||
|
boxes_diff_ratio > boxes_diff_ratio_threshold)
|
||||||
if is_diff:
|
if is_diff:
|
||||||
write2file("result.txt")
|
write2file("result.txt")
|
||||||
else:
|
else:
|
||||||
|
@@ -48,14 +48,14 @@ tar xvf $CPP_FASTDEPLOY_PACKAGE.tgz
|
|||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/../$CPP_FASTDEPLOY_PACKAGE -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER
|
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/../$CPP_FASTDEPLOY_PACKAGE -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER
|
||||||
make -j
|
make -j
|
||||||
|
ret=0
|
||||||
for((i=0;i<case_number;i+=1))
|
for((i=0;i<case_number;i+=1))
|
||||||
do
|
do
|
||||||
backend=${RUN_CASE[i]}
|
backend=${RUN_CASE[i]}
|
||||||
echo "Cpp Backend:" $backend
|
echo "Cpp Backend:" $backend
|
||||||
if [ "$backend" != "trt" ];then
|
if [ "$backend" != "trt" ];then
|
||||||
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=cpu --backend=$backend >> cpp_cpu_result.txt
|
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=cpu --backend=$backend >> cpp_$backend\_cpu_result.txt
|
||||||
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_cpu_result.txt --platform $PLATFORM --device cpu --conf_threshold $CONF_THRESHOLD
|
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_$backend\_cpu_result.txt --platform $PLATFORM --device cpu --conf_threshold $CONF_THRESHOLD
|
||||||
fi
|
fi
|
||||||
if [ "$DEVICE" = "gpu" ];then
|
if [ "$DEVICE" = "gpu" ];then
|
||||||
|
|
||||||
@@ -63,14 +63,15 @@ do
|
|||||||
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=gpu --backend=$backend >> cpp_trt_result.txt
|
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=gpu --backend=$backend >> cpp_trt_result.txt
|
||||||
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_trt_result.txt --platform $PLATFORM --device trt --conf_threshold $CONF_THRESHOLD
|
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_trt_result.txt --platform $PLATFORM --device trt --conf_threshold $CONF_THRESHOLD
|
||||||
else
|
else
|
||||||
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=gpu --backend=$backend >> cpp_gpu_result.txt
|
./infer_ppyoloe_demo --model_dir=$MODEL_PATH --image_file=$IMAGE_PATH --device=gpu --backend=$backend >> cpp_$backend\_gpu_result.txt
|
||||||
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_gpu_result.txt --platform $PLATFORM --device gpu --conf_threshold $CONF_THRESHOLD
|
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path cpp_$backend\_gpu_result.txt --platform $PLATFORM --device gpu --conf_threshold $CONF_THRESHOLD
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ $? -ne 0 ];then
|
||||||
|
ret=-1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
res_file="result.txt"
|
res_file="result.txt"
|
||||||
if [ ! -f $res_file ];then
|
if [ ! -f $res_file ];then
|
||||||
if [ $ret -ne 0 ];then
|
if [ $ret -ne 0 ];then
|
||||||
|
@@ -54,7 +54,7 @@ void CpuInfer(const std::string& model_dir, const std::string& image_file) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto model = fastdeploy::vision::detection::PPYOLOE(model_file, params_file,
|
auto model = fastdeploy::vision::detection::PPYOLOE(model_file, params_file,
|
||||||
config_file);
|
config_file, option);
|
||||||
if (!model.Initialized()) {
|
if (!model.Initialized()) {
|
||||||
std::cerr << "Failed to initialize." << std::endl;
|
std::cerr << "Failed to initialize." << std::endl;
|
||||||
return;
|
return;
|
||||||
|
@@ -41,6 +41,7 @@ fi
|
|||||||
case_number=${#RUN_CASE[@]}
|
case_number=${#RUN_CASE[@]}
|
||||||
py_version=$(python -V | awk '{print $2}')
|
py_version=$(python -V | awk '{print $2}')
|
||||||
echo "py_version:" $py_version
|
echo "py_version:" $py_version
|
||||||
|
ret=0
|
||||||
for((j=0;j<case_number;j+=1))
|
for((j=0;j<case_number;j+=1))
|
||||||
do
|
do
|
||||||
backend=${RUN_CASE[j]}
|
backend=${RUN_CASE[j]}
|
||||||
@@ -59,9 +60,11 @@ do
|
|||||||
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path py_$backend\_gpu_result.txt --platform $PLATFORM --device gpu
|
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path py_$backend\_gpu_result.txt --platform $PLATFORM --device gpu
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ $? -ne 0 ];then
|
||||||
|
ret=-1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
res_file="result.txt"
|
res_file="result.txt"
|
||||||
if [ ! -f $res_file ];then
|
if [ ! -f $res_file ];then
|
||||||
|
Reference in New Issue
Block a user