Fix PPOCRLabel bugs, release PPOCRLabel 2.1.3 (#8402)
* Fix PPOCRLabel bugs, release PPOCRLabel 2.1.3 Fix PPOCRLabel bugs due to the upgrade of paddleocr, release PPOCRLabel 2.1.3 * Update PPOCRLabel's requirements Update PPOCRLabel's requirements * Update PPOCRLabel README Update PPOCRLabel README * Update PPOCRLabel Update PPOCRLabelpull/8414/head
parent
d1a3c1bc1f
commit
0dc1556699
|
@ -1617,8 +1617,9 @@ class MainWindow(QMainWindow):
|
||||||
key_cls = 'None' if not self.kie_mode else box.get('key_cls', 'None')
|
key_cls = 'None' if not self.kie_mode else box.get('key_cls', 'None')
|
||||||
shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False)))
|
shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False)))
|
||||||
|
|
||||||
self.loadLabels(shapes)
|
if shapes != []:
|
||||||
self.canvas.verified = False
|
self.loadLabels(shapes)
|
||||||
|
self.canvas.verified = False
|
||||||
|
|
||||||
def validFilestate(self, filePath):
|
def validFilestate(self, filePath):
|
||||||
if filePath not in self.fileStatedict.keys():
|
if filePath not in self.fileStatedict.keys():
|
||||||
|
@ -2203,7 +2204,7 @@ class MainWindow(QMainWindow):
|
||||||
msg = 'Can not recognise the detection box in ' + self.filePath + '. Please change manually'
|
msg = 'Can not recognise the detection box in ' + self.filePath + '. Please change manually'
|
||||||
QMessageBox.information(self, "Information", msg)
|
QMessageBox.information(self, "Information", msg)
|
||||||
return
|
return
|
||||||
result = self.ocr.ocr(img_crop, cls=True, det=False)
|
result = self.ocr.ocr(img_crop, cls=True, det=False)[0]
|
||||||
if result[0][0] != '':
|
if result[0][0] != '':
|
||||||
if shape.line_color == DEFAULT_LOCK_COLOR:
|
if shape.line_color == DEFAULT_LOCK_COLOR:
|
||||||
shape.label = result[0][0]
|
shape.label = result[0][0]
|
||||||
|
@ -2264,7 +2265,7 @@ class MainWindow(QMainWindow):
|
||||||
msg = 'Can not recognise the detection box in ' + self.filePath + '. Please change manually'
|
msg = 'Can not recognise the detection box in ' + self.filePath + '. Please change manually'
|
||||||
QMessageBox.information(self, "Information", msg)
|
QMessageBox.information(self, "Information", msg)
|
||||||
return
|
return
|
||||||
result = self.ocr.ocr(img_crop, cls=True, det=False)
|
result = self.ocr.ocr(img_crop, cls=True, det=False)[0]
|
||||||
if result[0][0] != '':
|
if result[0][0] != '':
|
||||||
result.insert(0, box)
|
result.insert(0, box)
|
||||||
print('result in reRec is ', result)
|
print('result in reRec is ', result)
|
||||||
|
@ -2415,12 +2416,12 @@ class MainWindow(QMainWindow):
|
||||||
# merge the text result in the cell
|
# merge the text result in the cell
|
||||||
texts = ''
|
texts = ''
|
||||||
probs = 0. # the probability of the cell is avgerage prob of every text box in the cell
|
probs = 0. # the probability of the cell is avgerage prob of every text box in the cell
|
||||||
bboxes = self.ocr.ocr(img_crop, det=True, rec=False, cls=False)
|
bboxes = self.ocr.ocr(img_crop, det=True, rec=False, cls=False)[0]
|
||||||
if len(bboxes) > 0:
|
if len(bboxes) > 0:
|
||||||
bboxes.reverse() # top row text at first
|
bboxes.reverse() # top row text at first
|
||||||
for _bbox in bboxes:
|
for _bbox in bboxes:
|
||||||
patch = get_rotate_crop_image(img_crop, np.array(_bbox, np.float32))
|
patch = get_rotate_crop_image(img_crop, np.array(_bbox, np.float32))
|
||||||
rec_res = self.ocr.ocr(patch, det=False, rec=True, cls=False)
|
rec_res = self.ocr.ocr(patch, det=False, rec=True, cls=False)[0]
|
||||||
text = rec_res[0][0]
|
text = rec_res[0][0]
|
||||||
if text != '':
|
if text != '':
|
||||||
texts += text + ('' if text[0].isalpha() else ' ') # add space between english word
|
texts += text + ('' if text[0].isalpha() else ' ') # add space between english word
|
||||||
|
|
|
@ -103,11 +103,11 @@ python PPOCRLabel.py --kie True # [KIE mode] for [detection + recognition + keyw
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 1.2.3 Build and Install the Whl Package Locally
|
#### 1.2.3 Build and Install the Whl Package Locally
|
||||||
Compile and install a new whl package, where 1.0.2 is the version number, you can specify the new version in 'setup.py'.
|
Compile and install a new whl package, where 0.0.0 is the version number, you can specify the new version in 'setup.py'.
|
||||||
```bash
|
```bash
|
||||||
cd ./PPOCRLabel
|
cd ./PPOCRLabel
|
||||||
python3 setup.py bdist_wheel
|
python3 setup.py bdist_wheel
|
||||||
pip3 install dist/PPOCRLabel-2.1.2-py2.py3-none-any.whl
|
pip3 install dist/PPOCRLabel-0.0.0-py2.py3-none-any.whl
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,12 +101,12 @@ python PPOCRLabel.py --lang ch
|
||||||
|
|
||||||
#### 1.2.3 本地构建whl包并安装
|
#### 1.2.3 本地构建whl包并安装
|
||||||
|
|
||||||
编译与安装新的whl包,其中1.0.2为版本号,可在 `setup.py` 中指定新版本。
|
编译与安装新的whl包,其中0.0.0为版本号,可在 `setup.py` 中指定新版本。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ./PPOCRLabel
|
cd ./PPOCRLabel
|
||||||
python3 setup.py bdist_wheel
|
python3 setup.py bdist_wheel
|
||||||
pip3 install dist/PPOCRLabel-2.1.2-py2.py3-none-any.whl -i https://mirror.baidu.com/pypi/simple
|
pip3 install dist/PPOCRLabel-0.0.0-py2.py3-none-any.whl -i https://mirror.baidu.com/pypi/simple
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Worker(QThread):
|
||||||
if self.model == 'paddle':
|
if self.model == 'paddle':
|
||||||
h, w, _ = cv2.imdecode(np.fromfile(Imgpath, dtype=np.uint8), 1).shape
|
h, w, _ = cv2.imdecode(np.fromfile(Imgpath, dtype=np.uint8), 1).shape
|
||||||
if h > 32 and w > 32:
|
if h > 32 and w > 32:
|
||||||
self.result_dic = self.ocr.ocr(Imgpath, cls=True, det=True)
|
self.result_dic = self.ocr.ocr(Imgpath, cls=True, det=True)[0]
|
||||||
else:
|
else:
|
||||||
print('The size of', Imgpath, 'is too small to be recognised')
|
print('The size of', Imgpath, 'is too small to be recognised')
|
||||||
self.result_dic = None
|
self.result_dic = None
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
pyqt5
|
pyqt5
|
||||||
paddleocr==2.6.0.0
|
paddleocr
|
||||||
xlrd==1.2.0
|
xlrd==1.2.0
|
||||||
|
|
|
@ -33,10 +33,10 @@ setup(
|
||||||
package_dir={'PPOCRLabel': ''},
|
package_dir={'PPOCRLabel': ''},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points={"console_scripts": ["PPOCRLabel= PPOCRLabel.PPOCRLabel:main"]},
|
entry_points={"console_scripts": ["PPOCRLabel= PPOCRLabel.PPOCRLabel:main"]},
|
||||||
version='2.1.2',
|
version='2.1.3',
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
license='Apache License 2.0',
|
license='Apache License 2.0',
|
||||||
description='PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, with built-in PPOCR model to automatically detect and re-recognize data. It is written in python3 and pyqt5, supporting rectangular box annotation and four-point annotation modes. Annotations can be directly used for the training of PPOCR detection and recognition models',
|
description='PPOCRLabelv2 is a semi-automatic graphic annotation tool suitable for OCR field, with built-in PP-OCR model to automatically detect and re-recognize data. It is written in Python3 and PyQT5, supporting rectangular box, table, irregular text and key information annotation modes. Annotations can be directly used for the training of PP-OCR detection and recognition models.',
|
||||||
long_description=readme(),
|
long_description=readme(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
url='https://github.com/PaddlePaddle/PaddleOCR',
|
url='https://github.com/PaddlePaddle/PaddleOCR',
|
||||||
|
|
Loading…
Reference in New Issue