paddlex和paddledetection预测视频速度差异过大
Created by: lhy823436493
在paddlex训练完导出模型后,用下面代码预测视频用时五分钟,用paddledetection中deploy下的infer.py使用该模型预测同一个视频只需要不到一分钟,请问是为什么?
`model = pdx.load_model("model") capture = cv2.VideoCapture('./new.mp4') fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') video_writer = cv2.VideoWriter(filename='result.mp4', fourcc=fourcc, fps=30, frameSize=(1984, 1080)) while True: # 取出一帧数据 ret, frame_rgb = capture.read() if frame_rgb is None: break
# PaddleX要求的输出是bgr格式
frame_bgr = cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2BGR).astype('float32')
# 进行预测
result = model.predict(frame_bgr)
im = pdx.det.visualize(frame_rgb, result, threshold=0.1,save_dir=None)
video_writer.write(im)
print(result)
capture.release() video_writer.release()`