Open MikeLud opened 1 year ago
The below code will reproduce the issue
import fastdeploy as fd
import time
import cv2
import os
def parse_arguments():
import argparse
import ast
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_file", required=True, help="Path of rknn model.")
parser.add_argument(
"--image", type=str, required=True, help="Path of test image file.")
return parser.parse_args()
if __name__ == "__main__":
num = 300
x = 1
for _ in range(num):
args = parse_arguments()
model_file = args.model_file
params_file = ""
# 配置runtime,加载模型
runtime_option = fd.RuntimeOption()
runtime_option.use_rknpu2()
inferenceTimeMs: int = 0
start_time = time.perf_counter()
model = fd.vision.detection.RKYOLOV7(
model_file,
runtime_option=runtime_option,
model_format=fd.ModelFormat.RKNN)
# 预测图片分割结果
im = cv2.imread(args.image)
inferenceTimeMs = int((time.perf_counter() - start_time) * 1000)
result = model.predict(im)
print("InferenceTimeMs " + str(inferenceTimeMs) + "Count" + str(x))
x += 1
# 可视化结果
vis_im = fd.vision.vis_detection(im, result, score_threshold=0.5)
cv2.imwrite("visualized_result.jpg", vis_im)
print("Visualized result save in ./visualized_result.jpg")
@Zheng-Bicheng Can you help with the above issue I am having?
Thanks Mike
@MikeLud Have you ever tried using sudo permissions to execute compiled programs?
@Zheng-Bicheng Do you mean when compiling the Python SDK, thanks for helping
@MikeLud Sorry, I understand that you are currently using the C++ SDK. Perhaps you can try using the following code.
sudo -E python3 main.py
I did not reproduce the error you made. I guess this problem may be caused by insufficient execution permissions of the application.
When I execute with the below it can not find the fastdeploy module. Did you use the code in this link https://github.com/PaddlePaddle/FastDeploy/issues/1858#issuecomment-1519324435
sudo -E python3 infer_rkyolov7.py --model_file yolov7-tiny/yolov7-tiny_tk2_RK3588_i8.rknn --image 000000014439.jpg
@Zheng-Bicheng
From what I can tell the below is not executing as part of the backend to free up the memory.
Environment
FastDeploy version: latest code in develop branch OS Platform: Linux (Linux 5.10.110-rockchip-rk3588 #23.02.2 SMP Fri Feb 17 23:59:20 UTC 2023) Hardware: e.g. Orange Pi 5 Rockchip RK3588S 8-core 64-bit processor Program Language: e.g. Python 3.9
Problem description
After running about 225 inferences I get the below errors