dlxj commited on
Commit
aeec220
·
1 Parent(s): f33ee14

# 关闭弯曲矫正,单字坐标它才准。否则坐标是矫正后图像的坐标

Browse files
Files changed (2) hide show
  1. draw_box.py +2 -2
  2. main_v6.py +4 -1
draw_box.py CHANGED
@@ -41,13 +41,13 @@ def draw_box(pth_webp, pth_boxs):
41
  cv2.imshow("box", img_color)
42
  cv2.waitKey(0)
43
 
44
- path_jpg = pth_webp.replace(".webp", ".jpg")
45
  cv2.imwrite(path_jpg, img_color)
46
 
47
  def do_drawbox():
48
 
49
  pth_box = 'output/SWX0005_00000_00001_res.json'
50
- pth_webp = 'output/SWX0005_00000_00001_output_img.png'
51
  draw_box(pth_webp, pth_box)
52
 
53
  if __name__ == "__main__":
 
41
  cv2.imshow("box", img_color)
42
  cv2.waitKey(0)
43
 
44
+ path_jpg = pth_webp.replace(".png", ".jpg")
45
  cv2.imwrite(path_jpg, img_color)
46
 
47
  def do_drawbox():
48
 
49
  pth_box = 'output/SWX0005_00000_00001_res.json'
50
+ pth_webp = 'output/SWX0005_00000_00001_input_img.png'
51
  draw_box(pth_webp, pth_box)
52
 
53
  if __name__ == "__main__":
main_v6.py CHANGED
@@ -4,6 +4,9 @@
4
  # see https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_det_safetensors
5
  # see https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_rec_safetensors
6
 
 
 
 
7
  """
8
 
9
  curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -45,7 +48,7 @@ if __name__ == '__main__':
45
  lang='chinese_cht', # 繁体字典
46
  return_word_box=True, # 返回每个字符的坐标
47
  use_doc_orientation_classify=True, # 整页方向(横/倒)
48
- # use_doc_unwarping=True, # 弯曲矫正,扫描古籍有用
49
  use_textline_orientation=True, # 文本行方向分类,竖排靠它
50
  text_det_thresh=0.1, # 默认 0.3 对古籍太高,漏淡墨
51
  text_det_box_thresh=0.1, # 同上
 
4
  # see https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_det_safetensors
5
  # see https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_rec_safetensors
6
 
7
+ # see https://github.com/PaddlePaddle/PaddleOCR/issues/16137 矫正后的图像我们也返回了,坐标是对应于矫正后图像的。另外图像矫正模块是不可逆的,没法把坐标映射回去。想要原图的结果可以关掉图像矫正模块
8
+
9
+
10
  """
11
 
12
  curl -LsSf https://astral.sh/uv/install.sh | sh
 
48
  lang='chinese_cht', # 繁体字典
49
  return_word_box=True, # 返回每个字符的坐标
50
  use_doc_orientation_classify=True, # 整页方向(横/倒)
51
+ use_doc_unwarping=False, # 关闭弯曲矫正,单字坐标它才准。否则坐标是矫正后图像的坐标
52
  use_textline_orientation=True, # 文本行方向分类,竖排靠它
53
  text_det_thresh=0.1, # 默认 0.3 对古籍太高,漏淡墨
54
  text_det_box_thresh=0.1, # 同上