mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2026-10-28 03:36:02 +08:00
add for SEED
This commit is contained in:
+10
-5
@@ -187,6 +187,7 @@ def train(config,
|
||||
|
||||
use_srn = config['Architecture']['algorithm'] == "SRN"
|
||||
model_type = config['Architecture']['model_type']
|
||||
algorithm = config['Architecture']['algorithm']
|
||||
|
||||
if 'start_epoch' in best_model_dict:
|
||||
start_epoch = best_model_dict['start_epoch']
|
||||
@@ -210,10 +211,14 @@ def train(config,
|
||||
images = batch[0]
|
||||
if use_srn:
|
||||
model_average = True
|
||||
if use_srn or model_type == 'table':
|
||||
preds = model(images, data=batch[1:])
|
||||
else:
|
||||
preds = model(images)
|
||||
# if use_srn or model_type == 'table' or algorithm == "ASTER":
|
||||
# preds = model(images, data=batch[1:])
|
||||
# else:
|
||||
# preds = model(images)
|
||||
preds = model(images, data=batch[1:])
|
||||
state_dict = model.state_dict()
|
||||
# for key in state_dict:
|
||||
# print(key)
|
||||
loss = loss_class(preds, batch)
|
||||
avg_loss = loss['loss']
|
||||
avg_loss.backward()
|
||||
@@ -395,7 +400,7 @@ def preprocess(is_train=False):
|
||||
alg = config['Architecture']['algorithm']
|
||||
assert alg in [
|
||||
'EAST', 'DB', 'SAST', 'Rosetta', 'CRNN', 'STARNet', 'RARE', 'SRN',
|
||||
'CLS', 'PGNet', 'Distillation', 'TableAttn'
|
||||
'CLS', 'PGNet', 'Distillation', 'TableAttn', 'ASTER'
|
||||
]
|
||||
|
||||
device = 'gpu:{}'.format(dist.ParallelEnv().dev_id) if use_gpu else 'cpu'
|
||||
|
||||
Reference in New Issue
Block a user