You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ocr_det_model = create_predictor(global_config["model"]["det"])
ocr_rec_model = create_predictor(global_config["model"]["rec"])
output = ocr_det_model.predict(paths, batch_size=8)
all_cropped_images = []
# 处理每张图片的检测结果
for idx, res in enumerate(output):
img = cv2.imread(file_path)
for range_idx in range(len(res.json["dt_polys"])):
area = res.json["dt_polys"][range_idx] # [点1, 点2, 点3, 点4]
x_min = int(min(point[0] for point in area))
x_max = int(max(point[0] for point in area))
y_min = int(min(point[1] for point in area))
y_max = int(max(point[1] for point in area))
cropped_img = img[y_min:y_max, x_min:x_max]
all_cropped_images.append(cropped_img)
rec_results = ocr_rec_model.predict(all_cropped_images, batch_size=8)
for i, rec_output in enumerate(rec_results):
print(rec_output.json)
描述问题
我使用PP-OCRv4_mobile_rec_pretrained,CPU环境,预测过程非常的缓慢。我之前使用的是PaddleOCR库使用的是ch_ppocr_mobile_v2.0模型,相同图片预测速度两者相差近三倍是正常的吗?
复现
使用PaddleX的代码示例:
环境
系统: windows10
Python: 3.10
Paddle环境: PaddlePaddle(CPU)和PaddleX 均为 3.0-beta2
The text was updated successfully, but these errors were encountered: