create_dl_layer_loss_focal T_create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal 创建深度学习层损失焦点(算子)
名称
create_dl_layer_loss_focal T_create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal — 创建焦点损失层。
签名
create_dl_layer_loss_focal ( : : DLLayerInput , DLLayerTarget , DLLayerWeights , DLLayerNormalization , LayerName , LossWeight , Gamma , ClassWeights , Type , GenParamName , GenParamValue : DLLayerLossFocal )
Herror T_create_dl_layer_loss_focal (const Htuple DLLayerInput , const Htuple DLLayerTarget , const Htuple DLLayerWeights , const Htuple DLLayerNormalization , const Htuple LayerName , const Htuple LossWeight , const Htuple Gamma , const Htuple ClassWeights , const Htuple Type , const Htuple GenParamName , const Htuple GenParamValue , Htuple* DLLayerLossFocal )
void CreateDlLayerLossFocal (const HTuple& DLLayerInput , const HTuple& DLLayerTarget , const HTuple& DLLayerWeights , const HTuple& DLLayerNormalization , const HTuple& LayerName , const HTuple& LossWeight , const HTuple& Gamma , const HTuple& ClassWeights , const HTuple& Type , const HTuple& GenParamName , const HTuple& GenParamValue , HTuple* DLLayerLossFocal )
HDlLayer HDlLayer ::CreateDlLayerLossFocal (const HDlLayer& DLLayerTarget , const HDlLayer& DLLayerWeights , const HDlLayer& DLLayerNormalization , const HString& LayerName , const HTuple& LossWeight , const HTuple& Gamma , const HTuple& ClassWeights , const HString& Type , const HTuple& GenParamName , const HTuple& GenParamValue ) const
HDlLayer HDlLayer ::CreateDlLayerLossFocal (const HDlLayer& DLLayerTarget , const HDlLayer& DLLayerWeights , const HDlLayer& DLLayerNormalization , const HString& LayerName , double LossWeight , double Gamma , double ClassWeights , const HString& Type , const HString& GenParamName , const HString& GenParamValue ) const
HDlLayer HDlLayer ::CreateDlLayerLossFocal (const HDlLayer& DLLayerTarget , const HDlLayer& DLLayerWeights , const HDlLayer& DLLayerNormalization , const char* LayerName , double LossWeight , double Gamma , double ClassWeights , const char* Type , const char* GenParamName , const char* GenParamValue ) const
HDlLayer HDlLayer ::CreateDlLayerLossFocal (const HDlLayer& DLLayerTarget , const HDlLayer& DLLayerWeights , const HDlLayer& DLLayerNormalization , const wchar_t* LayerName , double LossWeight , double Gamma , double ClassWeights , const wchar_t* Type , const wchar_t* GenParamName , const wchar_t* GenParamValue ) const
(
Windows only)
static void HOperatorSet .CreateDlLayerLossFocal (HTuple DLLayerInput , HTuple DLLayerTarget , HTuple DLLayerWeights , HTuple DLLayerNormalization , HTuple layerName , HTuple lossWeight , HTuple gamma , HTuple classWeights , HTuple type , HTuple genParamName , HTuple genParamValue , out HTuple DLLayerLossFocal )
HDlLayer HDlLayer .CreateDlLayerLossFocal (HDlLayer DLLayerTarget , HDlLayer DLLayerWeights , HDlLayer DLLayerNormalization , string layerName , HTuple lossWeight , HTuple gamma , HTuple classWeights , string type , HTuple genParamName , HTuple genParamValue )
HDlLayer HDlLayer .CreateDlLayerLossFocal (HDlLayer DLLayerTarget , HDlLayer DLLayerWeights , HDlLayer DLLayerNormalization , string layerName , double lossWeight , double gamma , double classWeights , string type , string genParamName , string genParamValue )
def create_dl_layer_loss_focal (dllayer_input : HHandle, dllayer_target : HHandle, dllayer_weights : HHandle, dllayer_normalization : HHandle, layer_name : str, loss_weight : Union[int, float], gamma : Union[int, float], class_weights : MaybeSequence[Union[int, float]], type : str, gen_param_name : MaybeSequence[str], gen_param_value : MaybeSequence[str]) -> HHandle
描述
算子 create_dl_layer_loss_focal create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal 创建一个焦点损失层,其句柄通过 DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal dllayer_loss_focal 返回。有关其定义和参数含义的详细信息,请参阅下方引用的参考资料。
该层期望接收多个层作为输入:
参数 LayerName LayerName LayerName LayerName layerName layer_name 用于设置单个层的名称。请注意,若使用 create_dl_model create_dl_model CreateDlModel CreateDlModel CreateDlModel create_dl_model 创建模型,则创建网络中的每个层必须具有唯一名称。
参数 LossWeight LossWeight LossWeight LossWeight lossWeight loss_weight 是网络中存在多个损失函数时的整体损失权重。
参数 Gamma Gamma Gamma Gamma gamma gamma 是焦点因子(focal factor)的指数。
参数 ClassWeights ClassWeights ClassWeights ClassWeights classWeights class_weights 定义了类特有的权重。某类的所有损失贡献均按给定因子加权。通常该值设为 1.0/(该类样本数量) 。注意:此数组长度必须与类别数量一致。默认值 [] 表示所有类别均采用 1.0 因子。
参数 Type Type Type Type type type 置焦点损失选项:
'focal_binary' "focal_binary" "focal_binary" "focal_binary" "focal_binary" "focal_binary" :
焦点损失。
'sigmoid_focal_binary' "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" :
焦点损失与 sigmoid 函数融合。
支持以下泛型参数 GenParamName GenParamName GenParamName GenParamName genParamName gen_param_name 及其对应值 GenParamValue GenParamValue GenParamValue GenParamValue genParamValue gen_param_value :
'is_inference_output' "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" :
确定 apply_dl_model apply_dl_model ApplyDlModel ApplyDlModel ApplyDlModel apply_dl_model 是否将此层的输出包含在字典 DLResultBatch DLResultBatch DLResultBatch DLResultBatch DLResultBatch dlresult_batch 中,即使未在 Outputs Outputs Outputs Outputs outputs outputs 中指定此层('true' "true" "true" "true" "true" "true" )或不包含('false' "false" "false" "false" "false" "false" )。
默认值: 'false' "false" "false" "false" "false" "false"
使用
create_dl_layer_loss_focal create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal 算子创建的层,其特定参数可通过其他算子进行设置与检索。下表概述了可通过 set_dl_model_layer_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param 设置的参数,以及可通过 get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param 或 get_dl_layer_param get_dl_layer_param GetDlLayerParam GetDlLayerParam GetDlLayerParam get_dl_layer_param 检索的参数。请注意,算子 set_dl_model_layer_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param 和 get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param
需基于 create_dl_model create_dl_model CreateDlModel CreateDlModel CreateDlModel create_dl_model 创建的模型。
泛型层参数
设置
获取
'is_inference_output' "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output"
'num_trainable_params' "num_trainable_params" "num_trainable_params" "num_trainable_params" "num_trainable_params" "num_trainable_params"
执行信息
多线程类型:可重入(与非独占算子并行运行)。
多线程作用域:全局(可从任何线程调用)。
未采用并行化处理。
参数
DLLayerInput DLLayerInput DLLayerInput DLLayerInput DLLayerInput dllayer_input (输入控制) dl_layer → HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
输入层。
DLLayerTarget DLLayerTarget DLLayerTarget DLLayerTarget DLLayerTarget dllayer_target (输入控制) dl_layer → HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
目标层。
DLLayerWeights DLLayerWeights DLLayerWeights DLLayerWeights DLLayerWeights dllayer_weights (输入控制) dl_layer → HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
权重层。
DLLayerNormalization DLLayerNormalization DLLayerNormalization DLLayerNormalization DLLayerNormalization dllayer_normalization (输入控制) dl_layer → HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
归一化层。
默认值:
[]
LayerName LayerName LayerName LayerName layerName layer_name (输入控制) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
输出层的名称。
LossWeight LossWeight LossWeight LossWeight lossWeight loss_weight (输入控制) number → HTuple Union[int, float] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
若网络中存在多个损失,则为总体损失权重。
默认值:
1.0
Gamma Gamma Gamma Gamma gamma gamma (输入控制) number → HTuple Union[int, float] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
焦点因子的指数。
默认值:
2.0
ClassWeights ClassWeights ClassWeights ClassWeights classWeights class_weights (输入控制) number(-array) → HTuple MaybeSequence[Union[int, float]] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
类特有的权重。
默认值:
[]
Type Type Type Type type type (输入控制) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
焦点损失类型。
默认值:
'focal_binary'
"focal_binary"
"focal_binary"
"focal_binary"
"focal_binary"
"focal_binary"
值列表:
'focal_binary' "focal_binary" "focal_binary" "focal_binary" "focal_binary" "focal_binary" , 'sigmoid_focal_binary' "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary"
GenParamName GenParamName GenParamName GenParamName genParamName gen_param_name (输入控制) attribute.name(-array) → HTuple MaybeSequence[str] HTuple Htuple (string) (string ) (HString ) (char* )
泛型输入参数名称。
默认值:
[]
值列表:
'is_inference_output' "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output"
GenParamValue GenParamValue GenParamValue GenParamValue genParamValue gen_param_value (输入控制) attribute.value(-array) → HTuple MaybeSequence[str] HTuple Htuple (string) (string ) (HString ) (char* )
泛型输入参数值。
默认值:
[]
建议值:
'true' "true" "true" "true" "true" "true" , 'false' "false" "false" "false" "false" "false"
DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal dllayer_loss_focal (输出控制) dl_layer → HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
焦点损失层。
参考文献
T. Lin, P. Goyal, R. Girshick, K. He and P. Dollar,
"Focal Loss for Dense Object Detection," in IEEE Transactions on Pattern
Analysis and Machine Intelligence, vol. 42, no. 2, pp. 318-327, 1 Feb. 2020,
doi: 10.1109/TPAMI.2018.2858826.
模块
深度学习训练