mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-09 10:37:36 +08:00
Add: [TW] cnocr model for tw
This commit is contained in:
parent
8e0a10974b
commit
93cc5e7bd7
BIN
bin/cnocr_models/tw/cnocr-v1.2.0-densenet-lite-gru-0063.params
Normal file
BIN
bin/cnocr_models/tw/cnocr-v1.2.0-densenet-lite-gru-0063.params
Normal file
Binary file not shown.
1905
bin/cnocr_models/tw/cnocr-v1.2.0-densenet-lite-gru-symbol.json
Normal file
1905
bin/cnocr_models/tw/cnocr-v1.2.0-densenet-lite-gru-symbol.json
Normal file
File diff suppressed because it is too large
Load Diff
5321
bin/cnocr_models/tw/label_cn.txt
Normal file
5321
bin/cnocr_models/tw/label_cn.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,16 @@ OCR_MODEL = {
|
|||||||
'cnocr': AlOcr(model_name='densenet-lite-gru', model_epoch=39, root='./bin/cnocr_models/cnocr', name='cnocr'),
|
'cnocr': AlOcr(model_name='densenet-lite-gru', model_epoch=39, root='./bin/cnocr_models/cnocr', name='cnocr'),
|
||||||
|
|
||||||
'jp': AlOcr(model_name='densenet-lite-gru', model_epoch=125, root='./bin/cnocr_models/jp', name='jp'),
|
'jp': AlOcr(model_name='densenet-lite-gru', model_epoch=125, root='./bin/cnocr_models/jp', name='jp'),
|
||||||
|
|
||||||
|
# Folder: ./bin/cnocr_models/tw
|
||||||
|
# Size: 8.43MB
|
||||||
|
# Model: densenet-lite-gru
|
||||||
|
# Epoch: 63
|
||||||
|
# Validation accuracy: 99.24%
|
||||||
|
# Font: Various, 6 kinds
|
||||||
|
# Charset: Numbers, Upper english characters, Chinese traditional characters
|
||||||
|
# _num_classes: 5322
|
||||||
|
'tw': AlOcr(model_name='densenet-lite-gru', model_epoch=63, root='./bin/cnocr_models/tw', name='tw'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +60,7 @@ class Ocr:
|
|||||||
self.letter = letter
|
self.letter = letter
|
||||||
self.threshold = threshold
|
self.threshold = threshold
|
||||||
self.alphabet = alphabet
|
self.alphabet = alphabet
|
||||||
|
self.lang = lang
|
||||||
self.cnocr = OCR_MODEL[lang]
|
self.cnocr = OCR_MODEL[lang]
|
||||||
|
|
||||||
def pre_process(self, image):
|
def pre_process(self, image):
|
||||||
@ -74,6 +85,10 @@ class Ocr:
|
|||||||
"""
|
"""
|
||||||
result = ''.join(result)
|
result = ''.join(result)
|
||||||
|
|
||||||
|
if self.lang == 'tw':
|
||||||
|
# There no letter `艦` in training dataset
|
||||||
|
result = result.replace('鑑', '艦')
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def ocr(self, image, direct_ocr=False):
|
def ocr(self, image, direct_ocr=False):
|
||||||
@ -104,6 +119,7 @@ class Digit(Ocr):
|
|||||||
Do OCR on a digit, such as `45`.
|
Do OCR on a digit, such as `45`.
|
||||||
Method ocr() returns int, or a list of int.
|
Method ocr() returns int, or a list of int.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789',
|
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789',
|
||||||
name=None):
|
name=None):
|
||||||
super().__init__(buttons, lang=lang, letter=letter, threshold=threshold, alphabet=alphabet, name=name)
|
super().__init__(buttons, lang=lang, letter=letter, threshold=threshold, alphabet=alphabet, name=name)
|
||||||
|
Loading…
Reference in New Issue
Block a user