We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
paddleocr中gen_lable.py对icdar2015数据转换有误
![image](https://user-images.githubusercontent.com/119492593/212064964-c7db056f-3209-41f6-a9e0-daa5bc790c61.png)

我用gen_lable.py转换的数据是这样子的，我感觉好像是错误的

不应该是：ch4_training_images/img_1.jpg	[{"transcription": "Genaxis Theatre", "points": [[377, 117], [463, 117], [465, 130], [378, 130]

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ppocr/postprocess/east_postprocess.py`
Content:
```
1 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from __future__ import absolute_import
16 from __future__ import division
17 from __future__ import print_function
18 
19 import numpy as np
20 from .locality_aware_nms import nms_locality
21 import cv2
22 import paddle
23 
24 import os
25 from ppocr.utils.utility import check_install
26 import sys
27 
28 
29 class EASTPostProcess(object):
30     """
31     The post process for EAST.
32     """
33 
34     def __init__(self,
35                  score_thresh=0.8,
36                  cover_thresh=0.1,
37                  nms_thresh=0.2,
38                  **kwargs):
39 
40         self.score_thresh = score_thresh
41         self.cover_thresh = cover_thresh
42         self.nms_thresh = nms_thresh
43 
44     def restore_rectangle_quad(self, origin, geometry):
45         """
46         Restore rectangle from quadrangle.
47         """
48         # quad
49         origin_concat = np.concatenate(
50             (origin, origin, origin, origin), axis=1)  # (n, 8)
51         pred_quads = origin_concat - geometry
52         pred_quads = pred_quads.reshape((-1, 4, 2))  # (n, 4, 2)
53         return pred_quads
54 
55     def detect(self,
56                score_map,
57                geo_map,
58                score_thresh=0.8,
59                cover_thresh=0.1,
60                nms_thresh=0.2):
61         """
62         restore text boxes from score map and geo map
63         """
64 
65         score_map = score_map[0]
66         geo_map = np.swapaxes(geo_map, 1, 0)
67         geo_map = np.swapaxes(geo_map, 1, 2)
68         # filter the score map
69         xy_text = np.argwhere(score_map > score_thresh)
70         if len(xy_text) == 0:
71             return []
72         # sort the text boxes via the y axis
73         xy_text = xy_text[np.argsort(xy_text[:, 0])]
74         #restore quad proposals
75         text_box_restored = self.restore_rectangle_quad(
76             xy_text[:, ::-1] * 4, geo_map[xy_text[:, 0], xy_text[:, 1], :])
77         boxes = np.zeros((text_box_restored.shape[0], 9), dtype=np.float32)
78         boxes[:, :8] = text_box_restored.reshape((-1, 8))
79         boxes[:, 8] = score_map[xy_text[:, 0], xy_text[:, 1]]
80 
81         try:
82             check_install('lanms', 'lanms-nova')
83             import lanms
84         except:
85             print(
86                 'You should install lanms by pip3 install lanms-nova to speed up nms_locality'
87             )
88             boxes = nms_locality(boxes.astype(np.float64), nms_thresh)
89         if boxes.shape[0] == 0:
90             return []
91         # Here we filter some low score boxes by the average score map, 
92         #   this is different from the orginal paper.
93         for i, box in enumerate(boxes):
94             mask = np.zeros_like(score_map, dtype=np.uint8)
95             cv2.fillPoly(mask, box[:8].reshape(
96                 (-1, 4, 2)).astype(np.int32) // 4, 1)
97             boxes[i, 8] = cv2.mean(score_map, mask)[0]
98         boxes = boxes[boxes[:, 8] > cover_thresh]
99         return boxes
100 
101     def sort_poly(self, p):
102         """
103         Sort polygons.
104         """
105         min_axis = np.argmin(np.sum(p, axis=1))
106         p = p[[min_axis, (min_axis + 1) % 4,\
107             (min_axis + 2) % 4, (min_axis + 3) % 4]]
108         if abs(p[0, 0] - p[1, 0]) > abs(p[0, 1] - p[1, 1]):
109             return p
110         else:
111             return p[[0, 3, 2, 1]]
112 
113     def __call__(self, outs_dict, shape_list):
114         score_list = outs_dict['f_score']
115         geo_list = outs_dict['f_geo']
116         if isinstance(score_list, paddle.Tensor):
117             score_list = score_list.numpy()
118             geo_list = geo_list.numpy()
119         img_num = len(shape_list)
120         dt_boxes_list = []
121         for ino in range(img_num):
122             score = score_list[ino]
123             geo = geo_list[ino]
124             boxes = self.detect(
125                 score_map=score,
126                 geo_map=geo,
127                 score_thresh=self.score_thresh,
128                 cover_thresh=self.cover_thresh,
129                 nms_thresh=self.nms_thresh)
130             boxes_norm = []
131             if len(boxes) > 0:
132                 h, w = score.shape[1:]
133                 src_h, src_w, ratio_h, ratio_w = shape_list[ino]
134                 boxes = boxes[:, :8].reshape((-1, 4, 2))
135                 boxes[:, :, 0] /= ratio_w
136                 boxes[:, :, 1] /= ratio_h
137                 for i_box, box in enumerate(boxes):
138                     box = self.sort_poly(box.astype(np.int32))
139                     if np.linalg.norm(box[0] - box[1]) < 5 \
140                         or np.linalg.norm(box[3] - box[0]) < 5:
141                         continue
142                     boxes_norm.append(box)
143             dt_boxes_list.append({'points': np.array(boxes_norm)})
144         return dt_boxes_list
145
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ppocr/postprocess/east_postprocess.py b/ppocr/postprocess/east_postprocess.py
--- a/ppocr/postprocess/east_postprocess.py
+++ b/ppocr/postprocess/east_postprocess.py
@@ -81,6 +81,7 @@
         try:
             check_install('lanms', 'lanms-nova')
             import lanms
+            boxes = lanms.merge_quadrangle_n9(boxes, nms_thresh)
         except:
             print(
                 'You should install lanms by pip3 install lanms-nova to speed up nms_locality'

{"golden_diff": "diff --git a/ppocr/postprocess/east_postprocess.py b/ppocr/postprocess/east_postprocess.py\n--- a/ppocr/postprocess/east_postprocess.py\n+++ b/ppocr/postprocess/east_postprocess.py\n@@ -81,6 +81,7 @@\n         try:\n             check_install('lanms', 'lanms-nova')\n             import lanms\n+            boxes = lanms.merge_quadrangle_n9(boxes, nms_thresh)\n         except:\n             print(\n                 'You should install lanms by pip3 install lanms-nova to speed up nms_locality'\n", "issue": "paddleocr\u4e2dgen_lable.py\u5bf9icdar2015\u6570\u636e\u8f6c\u6362\u6709\u8bef\n![image](https://user-images.githubusercontent.com/119492593/212064964-c7db056f-3209-41f6-a9e0-daa5bc790c61.png)\r\n\r\n\u6211\u7528gen_lable.py\u8f6c\u6362\u7684\u6570\u636e\u662f\u8fd9\u6837\u5b50\u7684\uff0c\u6211\u611f\u89c9\u597d\u50cf\u662f\u9519\u8bef\u7684\r\n\r\n\u4e0d\u5e94\u8be5\u662f\uff1ach4_training_images/img_1.jpg\t[{\"transcription\": \"Genaxis Theatre\", \"points\": [[377, 117], [463, 117], [465, 130], [378, 130]\n", "before_files": [{"content": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport numpy as np\nfrom .locality_aware_nms import nms_locality\nimport cv2\nimport paddle\n\nimport os\nfrom ppocr.utils.utility import check_install\nimport sys\n\n\nclass EASTPostProcess(object):\n    \"\"\"\n    The post process for EAST.\n    \"\"\"\n\n    def __init__(self,\n                 score_thresh=0.8,\n                 cover_thresh=0.1,\n                 nms_thresh=0.2,\n                 **kwargs):\n\n        self.score_thresh = score_thresh\n        self.cover_thresh = cover_thresh\n        self.nms_thresh = nms_thresh\n\n    def restore_rectangle_quad(self, origin, geometry):\n        \"\"\"\n        Restore rectangle from quadrangle.\n        \"\"\"\n        # quad\n        origin_concat = np.concatenate(\n            (origin, origin, origin, origin), axis=1)  # (n, 8)\n        pred_quads = origin_concat - geometry\n        pred_quads = pred_quads.reshape((-1, 4, 2))  # (n, 4, 2)\n        return pred_quads\n\n    def detect(self,\n               score_map,\n               geo_map,\n               score_thresh=0.8,\n               cover_thresh=0.1,\n               nms_thresh=0.2):\n        \"\"\"\n        restore text boxes from score map and geo map\n        \"\"\"\n\n        score_map = score_map[0]\n        geo_map = np.swapaxes(geo_map, 1, 0)\n        geo_map = np.swapaxes(geo_map, 1, 2)\n        # filter the score map\n        xy_text = np.argwhere(score_map > score_thresh)\n        if len(xy_text) == 0:\n            return []\n        # sort the text boxes via the y axis\n        xy_text = xy_text[np.argsort(xy_text[:, 0])]\n        #restore quad proposals\n        text_box_restored = self.restore_rectangle_quad(\n            xy_text[:, ::-1] * 4, geo_map[xy_text[:, 0], xy_text[:, 1], :])\n        boxes = np.zeros((text_box_restored.shape[0], 9), dtype=np.float32)\n        boxes[:, :8] = text_box_restored.reshape((-1, 8))\n        boxes[:, 8] = score_map[xy_text[:, 0], xy_text[:, 1]]\n\n        try:\n            check_install('lanms', 'lanms-nova')\n            import lanms\n        except:\n            print(\n                'You should install lanms by pip3 install lanms-nova to speed up nms_locality'\n            )\n            boxes = nms_locality(boxes.astype(np.float64), nms_thresh)\n        if boxes.shape[0] == 0:\n            return []\n        # Here we filter some low score boxes by the average score map, \n        #   this is different from the orginal paper.\n        for i, box in enumerate(boxes):\n            mask = np.zeros_like(score_map, dtype=np.uint8)\n            cv2.fillPoly(mask, box[:8].reshape(\n                (-1, 4, 2)).astype(np.int32) // 4, 1)\n            boxes[i, 8] = cv2.mean(score_map, mask)[0]\n        boxes = boxes[boxes[:, 8] > cover_thresh]\n        return boxes\n\n    def sort_poly(self, p):\n        \"\"\"\n        Sort polygons.\n        \"\"\"\n        min_axis = np.argmin(np.sum(p, axis=1))\n        p = p[[min_axis, (min_axis + 1) % 4,\\\n            (min_axis + 2) % 4, (min_axis + 3) % 4]]\n        if abs(p[0, 0] - p[1, 0]) > abs(p[0, 1] - p[1, 1]):\n            return p\n        else:\n            return p[[0, 3, 2, 1]]\n\n    def __call__(self, outs_dict, shape_list):\n        score_list = outs_dict['f_score']\n        geo_list = outs_dict['f_geo']\n        if isinstance(score_list, paddle.Tensor):\n            score_list = score_list.numpy()\n            geo_list = geo_list.numpy()\n        img_num = len(shape_list)\n        dt_boxes_list = []\n        for ino in range(img_num):\n            score = score_list[ino]\n            geo = geo_list[ino]\n            boxes = self.detect(\n                score_map=score,\n                geo_map=geo,\n                score_thresh=self.score_thresh,\n                cover_thresh=self.cover_thresh,\n                nms_thresh=self.nms_thresh)\n            boxes_norm = []\n            if len(boxes) > 0:\n                h, w = score.shape[1:]\n                src_h, src_w, ratio_h, ratio_w = shape_list[ino]\n                boxes = boxes[:, :8].reshape((-1, 4, 2))\n                boxes[:, :, 0] /= ratio_w\n                boxes[:, :, 1] /= ratio_h\n                for i_box, box in enumerate(boxes):\n                    box = self.sort_poly(box.astype(np.int32))\n                    if np.linalg.norm(box[0] - box[1]) < 5 \\\n                        or np.linalg.norm(box[3] - box[0]) < 5:\n                        continue\n                    boxes_norm.append(box)\n            dt_boxes_list.append({'points': np.array(boxes_norm)})\n        return dt_boxes_list\n", "path": "ppocr/postprocess/east_postprocess.py"}], "after_files": [{"content": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport numpy as np\nfrom .locality_aware_nms import nms_locality\nimport cv2\nimport paddle\n\nimport os\nfrom ppocr.utils.utility import check_install\nimport sys\n\n\nclass EASTPostProcess(object):\n    \"\"\"\n    The post process for EAST.\n    \"\"\"\n\n    def __init__(self,\n                 score_thresh=0.8,\n                 cover_thresh=0.1,\n                 nms_thresh=0.2,\n                 **kwargs):\n\n        self.score_thresh = score_thresh\n        self.cover_thresh = cover_thresh\n        self.nms_thresh = nms_thresh\n\n    def restore_rectangle_quad(self, origin, geometry):\n        \"\"\"\n        Restore rectangle from quadrangle.\n        \"\"\"\n        # quad\n        origin_concat = np.concatenate(\n            (origin, origin, origin, origin), axis=1)  # (n, 8)\n        pred_quads = origin_concat - geometry\n        pred_quads = pred_quads.reshape((-1, 4, 2))  # (n, 4, 2)\n        return pred_quads\n\n    def detect(self,\n               score_map,\n               geo_map,\n               score_thresh=0.8,\n               cover_thresh=0.1,\n               nms_thresh=0.2):\n        \"\"\"\n        restore text boxes from score map and geo map\n        \"\"\"\n\n        score_map = score_map[0]\n        geo_map = np.swapaxes(geo_map, 1, 0)\n        geo_map = np.swapaxes(geo_map, 1, 2)\n        # filter the score map\n        xy_text = np.argwhere(score_map > score_thresh)\n        if len(xy_text) == 0:\n            return []\n        # sort the text boxes via the y axis\n        xy_text = xy_text[np.argsort(xy_text[:, 0])]\n        #restore quad proposals\n        text_box_restored = self.restore_rectangle_quad(\n            xy_text[:, ::-1] * 4, geo_map[xy_text[:, 0], xy_text[:, 1], :])\n        boxes = np.zeros((text_box_restored.shape[0], 9), dtype=np.float32)\n        boxes[:, :8] = text_box_restored.reshape((-1, 8))\n        boxes[:, 8] = score_map[xy_text[:, 0], xy_text[:, 1]]\n\n        try:\n            check_install('lanms', 'lanms-nova')\n            import lanms\n            boxes = lanms.merge_quadrangle_n9(boxes, nms_thresh)\n        except:\n            print(\n                'You should install lanms by pip3 install lanms-nova to speed up nms_locality'\n            )\n            boxes = nms_locality(boxes.astype(np.float64), nms_thresh)\n        if boxes.shape[0] == 0:\n            return []\n        # Here we filter some low score boxes by the average score map, \n        #   this is different from the orginal paper.\n        for i, box in enumerate(boxes):\n            mask = np.zeros_like(score_map, dtype=np.uint8)\n            cv2.fillPoly(mask, box[:8].reshape(\n                (-1, 4, 2)).astype(np.int32) // 4, 1)\n            boxes[i, 8] = cv2.mean(score_map, mask)[0]\n        boxes = boxes[boxes[:, 8] > cover_thresh]\n        return boxes\n\n    def sort_poly(self, p):\n        \"\"\"\n        Sort polygons.\n        \"\"\"\n        min_axis = np.argmin(np.sum(p, axis=1))\n        p = p[[min_axis, (min_axis + 1) % 4,\\\n            (min_axis + 2) % 4, (min_axis + 3) % 4]]\n        if abs(p[0, 0] - p[1, 0]) > abs(p[0, 1] - p[1, 1]):\n            return p\n        else:\n            return p[[0, 3, 2, 1]]\n\n    def __call__(self, outs_dict, shape_list):\n        score_list = outs_dict['f_score']\n        geo_list = outs_dict['f_geo']\n        if isinstance(score_list, paddle.Tensor):\n            score_list = score_list.numpy()\n            geo_list = geo_list.numpy()\n        img_num = len(shape_list)\n        dt_boxes_list = []\n        for ino in range(img_num):\n            score = score_list[ino]\n            geo = geo_list[ino]\n            boxes = self.detect(\n                score_map=score,\n                geo_map=geo,\n                score_thresh=self.score_thresh,\n                cover_thresh=self.cover_thresh,\n                nms_thresh=self.nms_thresh)\n            boxes_norm = []\n            if len(boxes) > 0:\n                h, w = score.shape[1:]\n                src_h, src_w, ratio_h, ratio_w = shape_list[ino]\n                boxes = boxes[:, :8].reshape((-1, 4, 2))\n                boxes[:, :, 0] /= ratio_w\n                boxes[:, :, 1] /= ratio_h\n                for i_box, box in enumerate(boxes):\n                    box = self.sort_poly(box.astype(np.int32))\n                    if np.linalg.norm(box[0] - box[1]) < 5 \\\n                        or np.linalg.norm(box[3] - box[0]) < 5:\n                        continue\n                    boxes_norm.append(box)\n            dt_boxes_list.append({'points': np.array(boxes_norm)})\n        return dt_boxes_list\n", "path": "ppocr/postprocess/east_postprocess.py"}]}