create_dl_layer_loss_focal T_create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal (Operator)
Name
create_dl_layer_loss_focal T_create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal
— Create a focal loss layer.
Signature
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
Description
The operator create_dl_layer_loss_focal create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal
creates a focal loss layer
whose handle is returned in DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal dllayer_loss_focal
.
See the reference cited below for further
information about its definition and parameter meanings.
This layer expects multiple layers as input:
The parameter LayerName LayerName LayerName LayerName layerName layer_name
sets an individual layer name.
Note that if creating a model using create_dl_model create_dl_model CreateDlModel CreateDlModel CreateDlModel create_dl_model
each layer of
the created network must have a unique name.
The parameter LossWeight LossWeight LossWeight LossWeight lossWeight loss_weight
is a overall loss weight if there are
multiple losses in the network.
The parameter Gamma Gamma Gamma Gamma gamma gamma
is the exponent of the focal factor.
The parameter ClassWeights ClassWeights ClassWeights ClassWeights classWeights class_weights
defines class specific weights. All loss
contributions of a class are weighted with the given factor.
Typically, this is set to 1.0/(Number of samples of the class) .
Note, the length of this array has to correspond to the
number of classes.
The default value [] corresponds to a factor of 1.0 for
all classes.
The parameter Type Type Type Type type type
sets the focal loss options:
'focal_binary' "focal_binary" "focal_binary" "focal_binary" "focal_binary" "focal_binary" :
Focal loss.
'sigmoid_focal_binary' "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" "sigmoid_focal_binary" :
Focal loss fused with sigmoid.
The following generic parameters GenParamName GenParamName GenParamName GenParamName genParamName gen_param_name
and the corresponding
values GenParamValue GenParamValue GenParamValue GenParamValue genParamValue gen_param_value
are supported:
'is_inference_output' "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" "is_inference_output" :
Determines whether apply_dl_model apply_dl_model ApplyDlModel ApplyDlModel ApplyDlModel apply_dl_model
will include the output of this
layer in the dictionary DLResultBatch DLResultBatch DLResultBatch DLResultBatch DLResultBatch dlresult_batch
even without specifying this
layer in Outputs Outputs Outputs Outputs outputs outputs
('true' "true" "true" "true" "true" "true" ) or not ('false' "false" "false" "false" "false" "false" ).
Default: 'false' "false" "false" "false" "false" "false"
Certain parameters of layers created using this operator
create_dl_layer_loss_focal create_dl_layer_loss_focal CreateDlLayerLossFocal CreateDlLayerLossFocal CreateDlLayerLossFocal create_dl_layer_loss_focal
can be set and retrieved using
further operators.
The following tables give an overview, which parameters can be set
using set_dl_model_layer_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param
and which ones can be retrieved
using get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param
or get_dl_layer_param get_dl_layer_param GetDlLayerParam GetDlLayerParam GetDlLayerParam get_dl_layer_param
.
Note, the operators set_dl_model_layer_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param
and
get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param
require a model created by
create_dl_model create_dl_model CreateDlModel CreateDlModel CreateDlModel create_dl_model
.
Generic Layer Parameters
set
get
'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"
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Processed without parallelization.
Parameters
DLLayerInput DLLayerInput DLLayerInput DLLayerInput DLLayerInput dllayer_input
(input_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Input layer.
DLLayerTarget DLLayerTarget DLLayerTarget DLLayerTarget DLLayerTarget dllayer_target
(input_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Target layer.
DLLayerWeights DLLayerWeights DLLayerWeights DLLayerWeights DLLayerWeights dllayer_weights
(input_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Weights layer.
DLLayerNormalization DLLayerNormalization DLLayerNormalization DLLayerNormalization DLLayerNormalization dllayer_normalization
(input_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Normalization layer.
Default:
[]
LayerName LayerName LayerName LayerName layerName layer_name
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Name of the output layer.
LossWeight LossWeight LossWeight LossWeight lossWeight loss_weight
(input_control) number →
HTuple Union[int, float] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Overall loss weight if there are multiple losses in the
network.
Default:
1.0
Gamma Gamma Gamma Gamma gamma gamma
(input_control) number →
HTuple Union[int, float] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Exponent of the focal factor.
Default:
2.0
ClassWeights ClassWeights ClassWeights ClassWeights classWeights class_weights
(input_control) number(-array) →
HTuple MaybeSequence[Union[int, float]] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Class specific weight.
Default:
[]
Type Type Type Type type type
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Focal loss type.
Default:
'focal_binary'
"focal_binary"
"focal_binary"
"focal_binary"
"focal_binary"
"focal_binary"
List of values:
'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
(input_control) attribute.name(-array) →
HTuple MaybeSequence[str] HTuple Htuple (string) (string ) (HString ) (char* )
Generic input parameter names.
Default:
[]
List of values:
'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
(input_control) attribute.value(-array) →
HTuple MaybeSequence[str] HTuple Htuple (string) (string ) (HString ) (char* )
Generic input parameter values.
Default:
[]
Suggested values:
'true' "true" "true" "true" "true" "true" , 'false' "false" "false" "false" "false" "false"
DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal DLLayerLossFocal dllayer_loss_focal
(output_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Focal loss layer.
References
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.
Module
Deep Learning Training