@@ -190,6 +190,15 @@ def AI_process_N(im0s,modelList,postProcess): | |||
return ret[0],timeInfos+ret[1] | |||
def getMaxScoreWords(detRets0): | |||
maxScore=-1;maxId=0 | |||
for i,detRet in enumerate(detRets0): | |||
if detRet[4]>maxScore: | |||
maxId=i | |||
maxScore = detRet[4] | |||
return maxId | |||
def AI_process_C(im0s,modelList,postProcess): | |||
#输入参数 | |||
@@ -204,22 +213,51 @@ def AI_process_C(im0s,modelList,postProcess): | |||
t0=time.time() | |||
detRets0 = modelList[0].eval(im0s[0]) | |||
detRets0 = detRets0[0] | |||
#detRets0=[[12, 46, 1127, 1544, 0.2340087890625, 2.0], [1884, 1248, 2992, 1485, 0.64208984375, 1.0]] | |||
detRets0 = list(filter(lambda x: x[5]<=2, detRets0 )) | |||
t1=time.time() | |||
imagePatches = [ im0s[0][int(x[1]):int(x[3]) ,int(x[0]):int(x[2])] for x in detRets0 ] | |||
detRets0 = detRets0[0] | |||
parsIn=postProcess['pars'] | |||
_detRets0_obj = list(filter(lambda x: x[5] in parsIn['objs'], detRets0 )) | |||
_detRets0_others = list(filter(lambda x: x[5] not in parsIn['objs'], detRets0 )) | |||
_detRets0 = [] | |||
if postProcess['name']=='channel2': | |||
if len(_detRets0_obj)>0: | |||
maxId=getMaxScoreWords(_detRets0_obj) | |||
_detRets0 = _detRets0_obj[maxId:maxId+1] | |||
else: _detRets0 = detRets0 | |||
t1=time.time() | |||
imagePatches = [ im0s[0][int(x[1]):int(x[3] ) ,int(x[0]):int(x[2])] for x in _detRets0 ] | |||
detRets1 = [modelList[1].eval(patch) for patch in imagePatches] | |||
detRets1 = [x[0]*255 for x in detRets1] | |||
t2=time.time() | |||
mixFunction =postProcess['function'] | |||
crackInfos = [mixFunction(patchMask) for patchMask in detRets1] | |||
rets = [ detRets0[i]+ crackInfos[i] for i in range(len(imagePatches)) ] | |||
t3=time.time() | |||
outInfos='total:%.1f (det:%.1f %d次segs:%.1f mixProcess:%.1f) '%( (t3-t0)*1000, (t1-t0)*1000, len(detRets1),(t2-t1)*1000, (t3-t2)*1000 ) | |||
if postProcess['name']=='crackMeasurement': | |||
detRets1 = [x[0]*255 for x in detRets1] | |||
t2=time.time() | |||
mixFunction =postProcess['function'] | |||
crackInfos = [mixFunction(patchMask,par=parsIn) for patchMask in detRets1] | |||
rets = [ _detRets0[i]+ crackInfos[i] for i in range(len(imagePatches)) ] | |||
t3=time.time() | |||
outInfos='total:%.1f (det:%.1f %d次segs:%.1f mixProcess:%.1f) '%( (t3-t0)*1000, (t1-t0)*1000, len(detRets1),(t2-t1)*1000, (t3-t2)*1000 ) | |||
elif postProcess['name']=='channel2': | |||
ocrInfo='no ocr' | |||
if len(_detRets0_obj)>0: | |||
print('##line246:',detRets1[0][0] ) | |||
res_real = detRets1[0][0] | |||
res_real="".join( list(filter(lambda x:(ord(x) >19968 and ord(x)<63865 ) or (ord(x) >47 and ord(x)<58 ),res_real))) | |||
#detRets1[0][0]="".join( list(filter(lambda x:(ord(x) >19968 and ord(x)<63865 ) or (ord(x) >47 and ord(x)<58 ),detRets1[0][0]))) | |||
_detRets0_obj[maxId].append(res_real ) | |||
_detRets0_obj = [_detRets0_obj[maxId]]##只输出有OCR的那个船名结果 | |||
ocrInfo=detRets1[0][1] | |||
rets=_detRets0_obj+_detRets0_others | |||
t3=time.time() | |||
outInfos='total:%.1f ,where det:%.1f, ocr:%s'%( (t3-t0)*1000, (t1-t0)*1000, ocrInfo) | |||
#print('###line233:',detRets1,detRets0 ) | |||
return rets,outInfos | |||
@@ -0,0 +1,198 @@ | |||
import tensorrt as trt | |||
import sys,os | |||
import cv2,glob,time | |||
import torch | |||
import utils | |||
import numpy as np | |||
from ocrUtils2.ocrUtils import strLabelConverter , OcrTrtForward,np_resize_keepRation | |||
class ocrModel(object): | |||
def __init__(self, weights=None, | |||
par={ | |||
#'cfg':'../AIlib2/weights/conf/OCR_Ch/360CC_config.yaml', | |||
'char_file':'../AIlib2/weights/conf/OCR_Ch/Ch.txt', | |||
'mode':'ch', | |||
'nc':3, | |||
'imgH':32, | |||
'imgW':256, | |||
'hidden':256, | |||
'mean':[0.5,0.5,0.5], | |||
'std':[0.5,0.5,0.5], | |||
'dynamic':False, | |||
} | |||
): | |||
self.par = par | |||
self.device = 'cuda:0' | |||
self.half =True | |||
self.dynamic = par['dynamic'] | |||
self.par['modelSize'] = (par['imgW'], par['imgH']) | |||
with open(par['char_file'], 'r') as fp: | |||
alphabet = fp.read() | |||
#self.converter = utils.strLabelConverter(alphabet) | |||
self.converter = strLabelConverter(alphabet) | |||
self.nclass = len(alphabet) + 1 | |||
if weights.endswith('.engine'): | |||
self.infer_type ='trt' | |||
elif weights.endswith('.pth') or weights.endswith('.pt') : | |||
self.infer_type ='pth' | |||
else: | |||
print('#########ERROR:',weights,': no registered inference type, exit') | |||
sys.exit(0) | |||
if self.infer_type=='trt': | |||
logger = trt.Logger(trt.Logger.ERROR) | |||
with open(weights, "rb") as f, trt.Runtime(logger) as runtime: | |||
self.model=runtime.deserialize_cuda_engine(f.read())# 输入trt本地文件,返回ICudaEngine对象 | |||
self.context = self.model.create_execution_context() | |||
elif self.infer_type=='pth': | |||
if par['mode']=='ch': | |||
import ocrUtils2.crnnCh as crnn | |||
self.model = crnn.CRNN(par['nc'], par['hidden'], self.nclass, par['imgH']) | |||
else: | |||
import ocrUtils2.crnn_model as crnn | |||
self.model = crnn.CRNN(par['imgH'], par['nc'], self.nclass,par['hidden'] ) | |||
self.load_model_weights(weights) | |||
self.model = self.model.to(self.device) | |||
print('#######load pt model:%s success '%(weights)) | |||
self.par['modelType']=self.infer_type | |||
print('#########加载模型:',weights,' 类型:',self.infer_type) | |||
def eval(self,image): | |||
t0 = time.time() | |||
image = self.preprocess_image(image) | |||
t1 = time.time() | |||
if self.infer_type=='pth': | |||
self.model.eval() | |||
preds = self.model(image) | |||
else: | |||
preds,trtstr=OcrTrtForward(self.model,[image],self.context) | |||
t2 = time.time() | |||
preds_size = torch.IntTensor([preds.size(0)]*1) | |||
_, preds = preds.max(2) | |||
preds = preds.transpose(1, 0).contiguous().view(-1) | |||
res_real = self.converter.decode(preds, preds_size, raw=False) | |||
t3 = time.time() | |||
timeInfos = 'total:%.1f (preProcess:%.1f ,inference:%.1f, postProcess:%.1f) '%( self.get_ms(t3,t0), self.get_ms(t1,t0), self.get_ms(t2,t1), self.get_ms(t3,t2), ) | |||
return res_real,timeInfos | |||
def preprocess_image(self,image): | |||
if self.par['nc']==1: | |||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |||
else: image = image[:,:,::-1] #bgr-->rgb | |||
if self.dynamic: | |||
H,W = image.shape[0:2] | |||
image = cv2.resize(image, (0, 0), fx=self.par['modelSize'][1] / H, fy=self.par['modelSize'][1] / H, interpolation=cv2.INTER_CUBIC) | |||
else: | |||
re_size = self.par['modelSize'] | |||
image = cv2.resize(image,re_size, interpolation=cv2.INTER_LINEAR) | |||
if self.infer_type=='trt': | |||
image = np_resize_keepRation(image,self.par['modelSize'][1] ,self.par['modelSize'][0] ) | |||
image = image.astype(np.float32) | |||
image /= 255.0 | |||
#print('####line105:',image.shape) | |||
if self.par['nc']==1: | |||
image = (image-self.par['mean'][0])/self.par['std'][0] | |||
image = np.expand_dims(image,0) | |||
else: | |||
image[:, :, 0] -= self.par['mean'][0] | |||
image[:, :, 1] -= self.par['mean'][1] | |||
image[:, :, 2] -= self.par['mean'][2] | |||
image[:, :, 0] /= self.par['std'][0] | |||
image[:, :, 1] /= self.par['std'][1] | |||
image[:, :, 2] /= self.par['std'][2] | |||
image = np.transpose(image, (2, 0, 1)) | |||
image = torch.from_numpy(image).float() | |||
image = image.unsqueeze(0) | |||
if self.device != 'cpu': | |||
image = image.to(self.device) | |||
return image | |||
def get_ms(self,t1,t0): | |||
return (t1-t0)*1000.0 | |||
def load_model_weights(self,weight): | |||
checkpoint = torch.load(weight) | |||
if 'state_dict' in checkpoint.keys(): | |||
self.model.load_state_dict(checkpoint['state_dict']) | |||
else: | |||
try: | |||
self.model.load_state_dict(checkpoint) | |||
except: | |||
##修正模型参数的名字 | |||
state_dict = torch.load(weight) | |||
# create new OrderedDict that does not contain `module.` | |||
from collections import OrderedDict | |||
new_state_dict = OrderedDict() | |||
for k, v in state_dict.items(): | |||
name = k[7:] # remove `module.` | |||
new_state_dict[name] = v | |||
# load params | |||
self.model.load_state_dict(new_state_dict) | |||
if __name__== "__main__": | |||
#weights = '/home/thsw2/WJ/src/OCR/benchmarking-chinese-text-recognition/weights/scene_base.pth' | |||
weights = '/mnt/thsw2/DSP2/weights/ocr2/crnn_ch_2080Ti_fp16_192X32.engine' | |||
par={ | |||
#'cfg':'../AIlib2/weights/conf/OCR_Ch/360CC_config.yaml', | |||
'char_file':'/home/thsw2/WJ/src/OCR/benchmarking-chinese-text-recognition/src/models/CRNN/data/benchmark.txt', | |||
'mode':'ch', | |||
'nc':3, | |||
'imgH':32, | |||
'imgW':192, | |||
'hidden':256, | |||
'mean':[0.5,0.5,0.5], | |||
'std':[0.5,0.5,0.5], | |||
'dynamic':False | |||
} | |||
inputDir = '/home/thsw2/WJ/src/OCR/shipNames' | |||
''' | |||
weights = '/home/thsw2/WJ/src/DSP2/AIlib2/weights/conf/ocr2/crnn_448X32.pth' | |||
#weights = '/mnt/thsw2/DSP2/weights/ocr2/crnn_en_2080Ti_fp16_448X32.engine' | |||
par={ | |||
#'cfg':'../AIlib2/weights/conf/OCR_Ch/360CC_config.yaml', | |||
'char_file':'/home/thsw2/WJ/src/DSP2/AIlib2/weights/conf/ocr2/chars2.txt', | |||
'mode':'en', | |||
'nc':1, | |||
'imgH':32, | |||
'imgW':448, | |||
'hidden':256, | |||
'mean':[0.588,0.588,0.588], | |||
'std':[0.193,0.193,0.193 ], | |||
'dynamic':True | |||
} | |||
inputDir='/home/thsw2/WJ/src/DSP2/AIdemo2/images/ocr_en' | |||
''' | |||
model = ocrModel(weights=weights,par=par ) | |||
imgUrls = glob.glob('%s/*.jpg'%(inputDir)) | |||
for imgUrl in imgUrls[0:]: | |||
img = cv2.imread(imgUrl) | |||
res_real,timeInfos = model.eval(img) | |||
res_real="".join( list(filter(lambda x:(ord(x) >19968 and ord(x)<63865 ) or (ord(x) >47 and ord(x)<58 ),res_real))) | |||
print(res_real,os.path.basename(imgUrl),timeInfos ) | |||
@@ -0,0 +1,86 @@ | |||
import torch.nn as nn | |||
import torch | |||
class BiLSTM(nn.Module): | |||
def __init__(self, nIn, nHidden, nOut): | |||
super(BiLSTM, self).__init__() | |||
self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True) | |||
self.embedding = nn.Linear(nHidden*2, nOut) | |||
def forward(self, input): | |||
if not hasattr(self, '_flattened'): | |||
self.rnn.flatten_parameters() | |||
setattr(self, '_flattened', True) | |||
rnnOut, _ = self.rnn(input) | |||
T, b, c = rnnOut.size() | |||
rnnOut = rnnOut.view(T*b, c) | |||
output = self.embedding(rnnOut) | |||
output = output.view(T, b, -1) | |||
return output | |||
class CRNN(nn.Module): | |||
def __init__(self, nc, nh, nclass, height, LeakyRelu=False): | |||
super(CRNN, self).__init__() | |||
kernal_size = [3, 3, 3, 3, 3, 3, 3] | |||
padding_size = [1, 1, 1, 1, 1, 1, 1] | |||
stride_size = [1, 1, 1, 1, 1, 1, 1] | |||
channels = [64, 128, 256, 256, 512, 512, 512] | |||
cnn = nn.Sequential() | |||
def convRelu(i, BatchNormalize=False): | |||
if i == 0: | |||
nIn = nc | |||
else: | |||
nIn = channels[i-1] | |||
nOut = channels[i] | |||
cnn.add_module('conv{0}'.format(i), | |||
nn.Conv2d(nIn, nOut, kernal_size[i], stride_size[i], padding_size[i])) | |||
if BatchNormalize: | |||
cnn.add_module('batchnorm{0}'.format(i), nn.BatchNorm2d(nOut)) | |||
if LeakyRelu: | |||
cnn.add_module('relu{0}'.format(i), nn.LeakyReLU(0.2, inplace=True)) | |||
else: | |||
cnn.add_module('relu{0}'.format(i), nn.ReLU(True)) | |||
convRelu(0) | |||
cnn.add_module('pooling{0}'.format(0), nn.MaxPool2d((2, 2), (1, 2), (1, 0))) | |||
convRelu(1) | |||
cnn.add_module('pooling{0}'.format(1), nn.MaxPool2d((2, 2), (1, 2), (1, 0))) | |||
convRelu(2, True) | |||
convRelu(3) | |||
cnn.add_module('pooling{0}'.format(2), | |||
nn.MaxPool2d((2,2), (2,1), (0,1))) | |||
convRelu(4, True) | |||
convRelu(5) | |||
cnn.add_module('pooling{0}'.format(3), | |||
nn.MaxPool2d((2,2), (2,1), (0,1))) | |||
convRelu(6, True) | |||
self.cnn = cnn | |||
self.avg_pooling = nn.AvgPool2d(kernel_size=(height//4, 1), stride=(height//4, 1)) | |||
self.rnn = nn.Sequential( | |||
BiLSTM(512, nh, nh), | |||
BiLSTM(nh, nh, nclass) | |||
) | |||
def forward(self, input): | |||
conv = self.cnn(input) | |||
conv = self.avg_pooling(conv) | |||
conv = conv.squeeze(2) | |||
conv = conv.permute(2, 0, 1) | |||
output = self.rnn(conv) | |||
return output | |||
if __name__=="__main__": | |||
img = torch.randn(60, 3, 64, 100).cuda(1) | |||
crnn = CRNN(3,256, 36, 64).cuda(1) | |||
res = crnn(img) | |||
print(res.size()) |
@@ -23,6 +23,7 @@ class BidirectionalLSTM(nn.Module): | |||
class CRNN(nn.Module): | |||
def __init__(self, imgH, nc, nclass, nh, n_rnn=2, leakyRelu=False): | |||
super(CRNN, self).__init__() | |||
assert imgH % 16 == 0, 'imgH has to be a multiple of 16' | |||
ks = [3, 3, 3, 3, 3, 3, 2] | |||
@@ -108,6 +109,7 @@ def load_model_weights(model,weight): | |||
def get_crnn(config,weights=None): | |||
model = CRNN(config.MODEL.IMAGE_SIZE.H, 1, config.MODEL.NUM_CLASSES + 1, config.MODEL.NUM_HIDDEN) | |||
if weights: | |||
load_model_weights(model,weights) | |||
''' |
@@ -76,17 +76,26 @@ def OcrTrtForward(engine,inputs,contextFlag=False): | |||
return outputs[0],outstr | |||
def np_resize_keepRation(img,inp_h, inp_w): | |||
img_h, img_w = img.shape | |||
#print(img.shape,inp_h,inp_w) | |||
img_h, img_w = img.shape[0:2] | |||
fy=inp_h/img_h | |||
keep_w = int(img_w* fy ) | |||
Rsize=( keep_w , img_h) | |||
img = cv2.resize(img, Rsize ) | |||
#resize后是120,max是160,120-160的地方用边界的值填充 | |||
if keep_w < inp_w: | |||
img_out = np.zeros((inp_h, inp_w ),dtype=np.uint8) | |||
img_out[:,:keep_w]=img[:,:] | |||
if len(img.shape)==3: | |||
img_out = np.zeros((inp_h, inp_w,3 ),dtype=np.uint8) | |||
img_out[:,:keep_w]=img[:,:] | |||
for j in range(3): | |||
img_out[:,keep_w:,j] = np.tile(img[:,keep_w-1:,j], inp_w-keep_w) | |||
else: | |||
img_out = np.zeros((inp_h, inp_w ),dtype=np.uint8) | |||
img_out[:,:keep_w]=img[:,:] | |||
img_out[:,keep_w:] = np.tile(img[:,keep_w-1:], inp_w-keep_w) | |||
img_out[:,keep_w:] = np.tile(img[:,keep_w-1:], inp_w-keep_w) | |||
else: | |||
img_out = cv2.resize(img,(inp_w,inp_h)) | |||
return img_out |
@@ -1,5 +1,5 @@ | |||
#import crnn_model.vgg_model as vgg | |||
import crnn_model | |||
import sys | |||
from ocrTrt import toONNX,ONNXtoTrt | |||
from collections import OrderedDict | |||
@@ -8,35 +8,42 @@ import argparse | |||
def crnnModel(opt): | |||
input_height=opt.mHeight | |||
input_width=opt.mWidth | |||
mode=opt.mode.strip() | |||
##生成识别模型 | |||
device='cuda:0' | |||
model_path = opt.weights | |||
recog_network, network_params = 'generation2', {'input_channel': 1, 'output_channel': 256, 'hidden_size': 256,'input_height':input_height} | |||
num_class= 97 | |||
model = crnn_model.CRNN(32, 1, 93, 256 ) | |||
if mode=='en': | |||
import crnn_model | |||
model = crnn_model.CRNN(32, 1, 93, 256 ) | |||
else: | |||
import crnnCh as crnn | |||
model = crnn.CRNN(3, 256, 7935, 32) | |||
print('####line24:',mode) | |||
checkpoint = torch.load(model_path) | |||
if 'state_dict' in checkpoint.keys(): | |||
model.load_state_dict(checkpoint['state_dict']) | |||
else: | |||
model.load_state_dict(checkpoint) | |||
try: | |||
model.load_state_dict(checkpoint) | |||
except: | |||
##修正模型参数的名字 | |||
state_dict = torch.load(model_path) | |||
# create new OrderedDict that does not contain `module.` | |||
from collections import OrderedDict | |||
new_state_dict = OrderedDict() | |||
for k, v in state_dict.items(): | |||
name = k[7:] # remove `module.` | |||
new_state_dict[name] = v | |||
# load params | |||
model.load_state_dict(new_state_dict) | |||
model = model.to(device) | |||
#model = vgg.Model(num_class=num_class, **network_params) | |||
##修正模型参数的名字 | |||
#state_dict = torch.load(model_path,map_location=device) | |||
#new_state_dict = OrderedDict() | |||
#for k, v in state_dict.items(): | |||
# name = k[7:] # remove `module.` | |||
# new_state_dict[name] = v | |||
# load params | |||
#model.load_state_dict(new_state_dict) | |||
#model = model.to(device) | |||
#model.load_state_dict(new_state_dict) | |||
return model | |||
@@ -46,6 +53,8 @@ if __name__=='__main__': | |||
parser.add_argument('--weights', type=str, default='english_g2.onnx', help='model path(s)') | |||
parser.add_argument('--mWidth', type=int, default=640, help='segmodel mWdith') | |||
parser.add_argument('--mHeight', type=int, default=360, help='segmodel mHeight') | |||
parser.add_argument('--mode', type=str, default='en', help='segmodel mHeight') | |||
opt = parser.parse_args() | |||
pthmodel = crnnModel(opt) | |||
@@ -55,7 +64,9 @@ if __name__=='__main__': | |||
trtFile=opt.weights.replace('.pth','_%dX%d.engine'%(opt.mWidth,opt.mHeight)) | |||
print('#'*20, ' begin to toONNX') | |||
toONNX(pthmodel,onnxFile,inputShape=(1,1,opt.mHeight, opt.mWidth),device='cuda:0') | |||
if opt.mode=='en':inputShape=(1,1,opt.mHeight, opt.mWidth) | |||
else: inputShape=(1,3,opt.mHeight, opt.mWidth) | |||
toONNX(pthmodel,onnxFile,inputShape=inputShape,device='cuda:0') | |||
print('#'*20, ' begin to TRT') | |||
ONNXtoTrt(onnxFile,trtFile,half=False) | |||
@@ -1,4 +1,7 @@ | |||
gpu=4090 mWidth=448 mHeight=32 | |||
pth=/mnt/thsw2/DSP2/weights/ocr2/crnn | |||
python pth2onnx.py --weights ${pth}.pth --mWidth ${mWidth} --mHeight ${mHeight} | |||
#gpu=2080Ti mWidth=448 mHeight=32 mode=en pth=/mnt/thsw2/DSP2/weights/ocr2/crnn_en | |||
gpu=2080Ti mWidth=192 mHeight=32 mode=ch pth=/mnt/thsw2/DSP2/weights/ocr2/crnn_ch | |||
python pth2onnx.py --weights ${pth}.pth --mode ${mode} --mWidth ${mWidth} --mHeight ${mHeight} | |||
mv ${pth}_${mWidth}X${mHeight}.engine ${pth}_${gpu}_fp16_${mWidth}X${mHeight}.engine |
@@ -1,61 +0,0 @@ | |||
GPUID: 0 | |||
WORKERS: 1 | |||
PRINT_FREQ: 10 | |||
SAVE_FREQ: 10 | |||
PIN_MEMORY: False | |||
OUTPUT_DIR: 'output' | |||
CUDNN: | |||
BENCHMARK: True | |||
DETERMINISTIC: False | |||
ENABLED: True | |||
DATASET: | |||
DATASET: 360CC | |||
ROOT: "../textGenerator/dataset/dataset9/images" | |||
CHAR_FILE: '../textGenerator/dataset/dataset9/chars.txt' | |||
JSON_FILE: {'train': '../textGenerator/dataset/dataset9/train.txt', 'val': '../textGenerator/dataset/dataset9/val.txt'} | |||
# JSON_FILE: {'train': 'H:/DL-DATASET/360M/train.txt', 'val': 'H:/DL-DATASET/360M/test.txt'} | |||
SCALE_FACTOR: 0.25 | |||
ROT_FACTOR: 30 | |||
STD: 0.193 | |||
MEAN: 0.588 | |||
ALPHABETS: '' | |||
TRAIN: | |||
BATCH_SIZE_PER_GPU: 32 | |||
SHUFFLE: True | |||
BEGIN_EPOCH: 0 | |||
END_EPOCH: 100 | |||
RESUME: | |||
IS_RESUME: False | |||
FILE: 'output/360CC/crnn/2023-04-27-13-01/checkpoints/checkpoint_99_acc_0.5030.pth' | |||
OPTIMIZER: 'adam' | |||
LR: 0.0001 | |||
WD: 0.0 | |||
LR_STEP: [60, 80] | |||
LR_FACTOR: 0.1 | |||
MOMENTUM: 0.0 | |||
NESTEROV: False | |||
RMSPROP_ALPHA: | |||
RMSPROP_CENTERED: | |||
FINETUNE: | |||
IS_FINETUNE: False | |||
FINETUNE_CHECKPOINIT: 'output/checkpoints/mixed_second_finetune_acc_97P7.pth' | |||
FREEZE: true | |||
TEST: | |||
BATCH_SIZE_PER_GPU: 16 | |||
SHUFFLE: True # for random test rather than test on the whole validation set | |||
NUM_TEST_BATCH: 1000 | |||
NUM_TEST_DISP: 10 | |||
MODEL: | |||
NAME: 'crnn' | |||
IMAGE_SIZE: | |||
OW: 160 # origial width: 280 | |||
H: 32 | |||
W: 160 # resized width: 160 | |||
NUM_CLASSES: 0 | |||
NUM_HIDDEN: 256 | |||
@@ -1,92 +0,0 @@ | |||
a | |||
b | |||
c | |||
d | |||
e | |||
f | |||
g | |||
h | |||
i | |||
j | |||
k | |||
l | |||
m | |||
n | |||
o | |||
p | |||
q | |||
r | |||
s | |||
t | |||
u | |||
v | |||
w | |||
x | |||
y | |||
z | |||
A | |||
B | |||
C | |||
D | |||
E | |||
F | |||
G | |||
H | |||
I | |||
J | |||
K | |||
L | |||
M | |||
N | |||
O | |||
P | |||
Q | |||
R | |||
S | |||
T | |||
U | |||
V | |||
W | |||
X | |||
Y | |||
Z | |||
0 | |||
1 | |||
2 | |||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
° | |||
! | |||
" | |||
# | |||
$ | |||
% | |||
& | |||
' | |||
( | |||
) | |||
* | |||
+ | |||
, | |||
- | |||
. | |||
/ | |||
: | |||
; | |||
? | |||
@ | |||
[ | |||
\ | |||
] | |||
^ | |||
_ | |||
` | |||
{ | |||
| | |||
} | |||
~ |
@@ -0,0 +1,5 @@ | |||
{ | |||
"labelnames_实际":["国旗","浮标","船名","船只" ], | |||
"labelnames":[ "国旗","浮标","船名","船只" ], | |||
"labelIndexs":["SL040", "SL041","SL042","SL043"] | |||
} |
@@ -0,0 +1 @@ | |||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789°!"#$%&'()*+,-./:;?@[\]^_`{|}~ |