Comments (1)
为了修复 调整ocropus-linegen中读到的文本内容的编码
print "# reading",text
with codecs.open(text,'r','utf-8') as stream:
for line in stream.readlines():
line = line.strip()
line = re.sub(args.cleanup,'',line)
if len(line)<1: continue
lines.append(line)
print "got",len(lines),"lines"
assert len(lines)>0
lines = list(set(lines))
print "got",len(lines),"unique lines"
修改成
print "# reading",text
with codecs.open(text,'r','utf-8') as stream:
for line in stream.readlines():
line = line.strip()
line = re.sub(args.cleanup,'',line)
line = line.encode('utf-8').strip()
if len(line)<1: continue
lines.append(line)
print "got",len(lines),"lines"
assert len(lines)>0
lines = list(set(lines))
print "got",len(lines),"unique lines"
os.mkdir(pagedir)
print "===",pagedir,font
lineno = 0
while lineno<args.maxlines:
reload(sys)
sys.setdefaultencoding('utf-8')
(sigma,ssigma,threshold,sthreshold) = pyrandom.choice(degradations)
sigma += (2*rand()-1)*ssigma
threshold += (2*rand()-1)*sthreshold
line = pyrandom.choice(lines) .encode('utf-8')
修改
os.mkdir(pagedir)
print "===",pagedir,font
lineno = 0
while lineno<args.maxlines:
reload(sys)
sys.setdefaultencoding('utf-8')
(sigma,ssigma,threshold,sthreshold) = pyrandom.choice(degradations)
sigma += (2*rand()-1)ssigma
threshold += (2rand()-1)*sthreshold
line = pyrandom.choice(lines)
line = line.encode('utf-8').strip()
为如下
root@4b2648975d03:/ocropy# python pic/ocropus-linegen -t pic/1-line.txt -f pic/simsun.ttc -m 1 -o 1-line
fonts ['pic/simsun.ttc']
pic/1-line.txt
# reading pic/1-line.txt
got 1 lines
got 1 unique lines
base 1-line
=== 1-line/pic_simsun pic/simsun.ttc
0.50 0.50 50 顷3974
root@4b2648975d03:/ocropy# ls -al 1-line/
total 16
drwxr-xr-x 3 root root 4096 May 9 07:41 .
drwxr-xr-x 14 root root 4096 May 9 07:41 ..
drwxr-xr-x 2 root root 4096 May 9 07:41 pic_simsun
-rw-r--r-- 1 root root 15 May 9 07:41 pic_simsun.info
from awesome-ocr.
Related Issues (20)
- OCR basics HOT 1
- EAST:An Efficient and Accurate Scene Text Detector HOT 1
- Robust, Simple Page Segmentation using Hybrid Convolutional MDLSTM Networks
- PixelLink: Detecting Scene Text via Instance Segmentation
- Table-to-Text: Describing Table Region with Natural Language
- lable tools
- how to modify the connectionist Temporal Classification (CTC) layer of the network to also give us a confidence score? HOT 2
- Confidence Prediction for Lexicon-Free OCR HOT 1
- 工业制造——Workplace of automated control of vibration output circular trays HOT 3
- Tesseract for R HOT 1
- Cut, Paste and Learn: Surprisingly Easy Synthesis for Instance Detection
- 【Rosetta:大规模图像文字检测识别系统】《Rosetta: Large scale system for text detection and recognition in images》[Facebook] (2018) O HOT 4
- Radical analysis network for zero-shot learning in printed Chinese character recognition HOT 3
- DenseRAN for Offline Handwritten Chinese Character Recognition HOT 3
- Deep TextSpotter: An End-to-End Trainable Scene Text Localization and Recognition Framework
- in marmot data set the table BBOX are not matching with original images
- dhSegment: A generic deep-learning approach for document segmentation
- null
- 2018年末撸串计划 HOT 5
- 希望可以增加PaddleOCR、AgentOCR HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-ocr.