mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 13:07:33 +08:00
Opt: No mxnet loading at first release_resources() for faster startup
This commit is contained in:
parent
e34b19d625
commit
5073054826
@ -2,15 +2,17 @@ import os
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
|
||||
logger.info('Loading OCR dependencies')
|
||||
from cnocr import CnOcr
|
||||
from cnocr.cn_ocr import (check_model_name, data_dir, gen_network, load_module,
|
||||
read_charset)
|
||||
from cnocr.fit.ctc_metrics import CtcMetrics
|
||||
from cnocr.hyperparams.cn_hyperparams import CnHyperparams as Hyperparams
|
||||
from PIL import Image
|
||||
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
|
||||
|
||||
def get_mxnet_context():
|
||||
|
@ -1,5 +1,4 @@
|
||||
from module.base.decorator import cached_property
|
||||
from module.ocr.al_ocr import AlOcr
|
||||
|
||||
|
||||
class OcrModel:
|
||||
@ -13,8 +12,9 @@ class OcrModel:
|
||||
# Font: Impact, AgencyFB-Regular, MStiffHeiHK-UltraBold
|
||||
# Charset: 0123456789ABCDEFGHIJKLMNPQRSTUVWXYZ:/- (Letter 'O' and <space> is not included)
|
||||
# _num_classes: 39
|
||||
from module.ocr.al_ocr import AlOcr
|
||||
return AlOcr(model_name='densenet-lite-gru', model_epoch=15, root='./bin/cnocr_models/azur_lane',
|
||||
name='azur_lane')
|
||||
name='azur_lane')
|
||||
|
||||
@cached_property
|
||||
def cnocr(self):
|
||||
@ -26,10 +26,12 @@ class OcrModel:
|
||||
# Font: Various
|
||||
# Charset: Number, English character, Chinese character, symbols, <space>
|
||||
# _num_classes: 6426
|
||||
from module.ocr.al_ocr import AlOcr
|
||||
return AlOcr(model_name='densenet-lite-gru', model_epoch=39, root='./bin/cnocr_models/cnocr', name='cnocr')
|
||||
|
||||
@cached_property
|
||||
def jp(self):
|
||||
from module.ocr.al_ocr import AlOcr
|
||||
return AlOcr(model_name='densenet-lite-gru', model_epoch=125, root='./bin/cnocr_models/jp', name='jp')
|
||||
|
||||
@cached_property
|
||||
@ -42,7 +44,8 @@ class OcrModel:
|
||||
# Font: Various, 6 kinds
|
||||
# Charset: Numbers, Upper english characters, Chinese traditional characters
|
||||
# _num_classes: 5322
|
||||
from module.ocr.al_ocr import AlOcr
|
||||
return AlOcr(model_name='densenet-lite-gru', model_epoch=63, root='./bin/cnocr_models/tw', name='tw')
|
||||
|
||||
|
||||
OCR_MODEL = OcrModel()
|
||||
OCR_MODEL = OcrModel()
|
||||
|
Loading…
Reference in New Issue
Block a user