mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2025-08-06 23:58:05 +00:00
17 lines
415 B
Python
17 lines
415 B
Python
![]() |
# -*- coding: utf-8 -*-
|
||
|
# @Time : 2020/6/5 11:36
|
||
|
# @Author : zhoujun
|
||
|
import copy
|
||
|
from .DB_loss import DBLoss
|
||
|
|
||
|
__all__ = ['build_loss']
|
||
|
support_loss = ['DBLoss']
|
||
|
|
||
|
|
||
|
def build_loss(config):
|
||
|
copy_config = copy.deepcopy(config)
|
||
|
loss_type = copy_config.pop('type')
|
||
|
assert loss_type in support_loss, f'all support loss is {support_loss}'
|
||
|
criterion = eval(loss_type)(**copy_config)
|
||
|
return criterion
|