91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 13MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2024-02-05
  • 語言: Python
  • 標簽:

資源簡介

本項目基于yolo3 與crnn 實現中文自然場景文字檢測及識別

資源截圖

代碼片段和文件信息

#?-*-?coding:?utf-8?-*-
“““
@author:?lywen
“““
import?os
import?cv2
import?json
import?time
import?uuid
import?base64
import?web
from?PIL?import?Image
web.config.debug??=?True
import?model
render?=?web.template.render(‘templates‘?base=‘base‘)
from?config?import?DETECTANGLE
from?apphelper.image?import?union_rboxadjust_box_to_origin
from?application?import?trainTicketidcard?


billList?=?[‘通用OCR‘‘火車票‘‘身份證‘]

class?OCR:
????“““通用OCR識別“““

????def?GET(self):
????????post?=?{}
????????post[‘postName‘]?=?‘ocr‘##請求地址
????????post[‘height‘]?=?1000
????????post[‘H‘]?=?1000
????????post[‘width‘]?=?600
????????post[‘W‘]?=?600
????????post[‘uuid‘]?=?uuid.uuid1().__str__()
????????post[‘billList‘]?=?billList
????????return?render.ocr(post)

????def?POST(self):
????????data?=?web.data()
????????data?=?json.loads(data)
????????billModel?=?data.get(‘billModel‘‘‘)
????????textAngle?=?data.get(‘textAngle‘False)##文字檢測
????????textLine?=?data.get(‘textLine‘False)##只進行單行識別
????????
????????imgString?=?data[‘imgString‘].encode().split(b‘;base64‘)[-1]
????????imgString?=?base64.b64decode(imgString)
????????jobid?=?uuid.uuid1().__str__()
????????path?=?‘test/{}.jpg‘.format(jobid)
????????with?open(path‘wb‘)?as?f:
????????????f.write(imgString)
????????img?=?cv2.imread(path)##GBR
????????HW?=?img.shape[:2]
????????timetake?=?time.time()
????????if?textLine:
????????????##單行識別
????????????partImg?=?Image.fromarray(img)
????????????text?=?model.crnnOcr(partImg.convert(‘L‘))
????????????res?=[?{‘text‘:text‘name‘:‘0‘‘box‘:[00W0WH0H]}?]
????????else:
????????????detectAngle?=?textAngle
????????????_resultangle=?model.model(img
????????????????????????????????????????detectAngle=detectAngle##是否進行文字方向檢測,通過web傳參控制
????????????????????????????????????????config=dict(MAX_HORIZONTAL_GAP=50##字符之間的最大間隔,用于文本行的合并
????????????????????????????????????????MIN_V_OVERLAPS=0.6
????????????????????????????????????????MIN_SIZE_SIM=0.6
????????????????????????????????????????TEXT_PROPOSALS_MIN_SCORE=0.1
????????????????????????????????????????TEXT_PROPOSALS_NMS_THRESH=0.3
????????????????????????????????????????TEXT_LINE_NMS_THRESH?=?0.7##文本行之間測iou值
????????????????????????????????????????????????)
????????????????????????????????????????leftAdjust=True##對檢測的文本行進行向左延伸
????????????????????????????????????????rightAdjust=True##對檢測的文本行進行向右延伸
????????????????????????????????????????alph=0.01##對檢測的文本行進行向右、左延伸的倍數
???????????????????????????????????????)



????????????if?billModel==‘‘?or?billModel==‘通用OCR‘?:
????????????????result?=?union_rbox(result0.2)
????????????????res?=?[{‘text‘:x[‘text‘]
????????????????????????‘name‘:str(i)
????????????????????????‘box‘:{‘cx‘:x[‘cx‘]
???????????????????????????????‘cy‘:x[‘cy‘]
???????????????????????????????‘w‘:x[‘w‘]
???????????????????????????????‘h‘:x[‘h‘]
???????????????????????????????‘angle‘:x[‘degree‘]

??????????????????????????????}
???????????????????????}?for?ix?in?enumerate(result)]
????????????????res?=?a

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\
?????文件?????????137??2019-07-18?15:12??chineseocr-master\.gitignore
?????文件??????????84??2019-07-18?15:12??chineseocr-master\.gitmodules
?????文件????????1017??2019-07-18?15:12??chineseocr-master\Dockerfile
?????文件????????1067??2019-07-18?15:12??chineseocr-master\LICENSE
?????文件????????3940??2019-07-18?15:12??chineseocr-master\README.md
?????文件????????3997??2019-07-18?15:12??chineseocr-master\app.py
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\apphelper\
?????文件?????????917??2019-07-18?15:12??chineseocr-master\apphelper\__init__.py
?????文件???????18337??2019-07-18?15:12??chineseocr-master\apphelper\image.py
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\application\
?????文件??????????82??2019-07-18?15:12??chineseocr-master\application\README.md
?????文件???????????0??2019-07-18?15:12??chineseocr-master\application\__init__.py
?????文件????????3380??2019-07-18?15:12??chineseocr-master\application\idcard.py
?????文件????????3020??2019-07-18?15:12??chineseocr-master\application\trainTicket.py
?????文件????????1999??2019-07-18?15:12??chineseocr-master\config.py
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\crnn\
?????文件???????????0??2019-07-18?15:12??chineseocr-master\crnn\__init__.py
?????文件????????1201??2019-07-18?15:12??chineseocr-master\crnn\crnn_keras.py
?????文件????????1994??2019-07-18?15:12??chineseocr-master\crnn\crnn_torch.py
?????文件????????3964??2019-07-18?15:12??chineseocr-master\crnn\dataset.py
?????文件???????16511??2019-07-18?15:12??chineseocr-master\crnn\keys.py
?????文件????????3649??2019-07-18?15:12??chineseocr-master\crnn\network_keras.py
?????文件????????3086??2019-07-18?15:12??chineseocr-master\crnn\network_torch.py
?????文件????????2911??2019-07-18?15:12??chineseocr-master\crnn\util.py
?????文件????????1115??2019-07-18?15:12??chineseocr-master\crnn\utils.py
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\darknet\
?????文件?????????139??2019-07-18?15:12??chineseocr-master\docker.sh
?????文件????????4201??2019-07-18?15:12??chineseocr-master\model.py
?????目錄???????????0??2019-07-18?15:12??chineseocr-master\models\
?????文件??????????45??2019-07-18?15:12??chineseocr-master\models\README.md
............此處省略299個文件信息

評論

共有 條評論

相關資源