Skip to content

create_dl_layer_zoom_factorCreateDlLayerZoomFactorCreateDlLayerZoomFactorcreate_dl_layer_zoom_factorT_create_dl_layer_zoom_factorπŸ”—

Short descriptionπŸ”—

create_dl_layer_zoom_factorCreateDlLayerZoomFactorCreateDlLayerZoomFactorcreate_dl_layer_zoom_factorT_create_dl_layer_zoom_factor β€” Create a zoom layer using size factors.

SignatureπŸ”—

create_dl_layer_zoom_factor( dl_layer DLLayerInput, string LayerName, number ScaleWidth, number ScaleHeight, string Interpolation, string AlignCorners, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerZoom )void CreateDlLayerZoomFactor( const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& ScaleWidth, const HTuple& ScaleHeight, const HTuple& Interpolation, const HTuple& AlignCorners, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerZoom )static void HOperatorSet.CreateDlLayerZoomFactor( HTuple DLLayerInput, HTuple layerName, HTuple scaleWidth, HTuple scaleHeight, HTuple interpolation, HTuple alignCorners, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerZoom )def create_dl_layer_zoom_factor( dllayer_input: HHandle, layer_name: str, scale_width: Union[int, float], scale_height: Union[int, float], interpolation: str, align_corners: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_zoom_factor( const Htuple DLLayerInput, const Htuple LayerName, const Htuple ScaleWidth, const Htuple ScaleHeight, const Htuple Interpolation, const Htuple AlignCorners, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerZoom )

HDlLayer HDlLayer::CreateDlLayerZoomFactor( const HString& LayerName, const HTuple& ScaleWidth, const HTuple& ScaleHeight, const HString& Interpolation, const HString& AlignCorners, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerZoomFactor( const HString& LayerName, double ScaleWidth, double ScaleHeight, const HString& Interpolation, const HString& AlignCorners, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerZoomFactor( const char* LayerName, double ScaleWidth, double ScaleHeight, const char* Interpolation, const char* AlignCorners, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerZoomFactor( const wchar_t* LayerName, double ScaleWidth, double ScaleHeight, const wchar_t* Interpolation, const wchar_t* AlignCorners, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerZoomFactor( string layerName, HTuple scaleWidth, HTuple scaleHeight, string interpolation, string alignCorners, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerZoomFactor( string layerName, double scaleWidth, double scaleHeight, string interpolation, string alignCorners, string genParamName, string genParamValue )

DescriptionπŸ”—

The operator create_dl_layer_zoom_factorCreateDlLayerZoomFactor creates a zoom layer using size factors and returns the layer handle in DLLayerZoomDLLayerZoomdllayer_zoom.

The parameter DLLayerInputDLLayerInputdllayer_input determines the feeding input layer and expects the layer handle as value.

The parameter LayerNamelayerNamelayer_name sets an individual layer name. Note that if creating a model using create_dl_modelCreateDlModel each layer of the created network must have a unique name.

The parameters ScaleWidthscaleWidthscale_width and ScaleHeightscaleHeightscale_height specify the ratio between the output and the corresponding input dimension. Together they define the output size of the zoom layer DLLayerZoomDLLayerZoomdllayer_zoom.

The parameter Interpolationinterpolationinterpolation defines the interpolation mode. Currently the modes 'bilinear'"bilinear" and 'nearest_neighbor'"nearest_neighbor" are supported.

The parameter AlignCornersalignCornersalign_corners defines how coordinates are transformed from the output to the input image. Alternatively, the generic parameter 'coordinate_transformation_mode'"coordinate_transformation_mode" can be specified. Note, that the specification of both parameters may not contradict each other:

  • AlignCornersalignCornersalign_corners = 'true'"true" or'coordinate_transformation_mode'"coordinate_transformation_mode" = 'align_corners'"align_corners": The transformation is applied in the HALCON Non-Standard Cartesian coordinate system (edge-centered, with the origin in the upper left corner, see chapter Transformations / 2D Transformations). Using the \(x\) axis as an example, this leads to:

    \[\begin{eqnarray*} x_{input} = x_{output} * (length_{input} - 1) / (length_{output} - 1) \end{eqnarray*}\]
  • AlignCornersalignCornersalign_corners = 'false'"false":

    • 'coordinate_transformation_mode'"coordinate_transformation_mode" ='half_pixel'"half_pixel" (default): The transformation is applied in the HALCON standard coordinate system (pixel centered, with the origin in the center of the upper left pixel, see chapter Transformations / 2D Transformations). Using the \(x\) axis as an example, this leads to:

      \[\begin{eqnarray*} x_{input} = (x_{output} + 0.5) * length_{input} / length_{output} - 0.5 \end{eqnarray*}\]
    • 'coordinate_transformation_mode'"coordinate_transformation_mode" = 'pytorch_half_pixel'"pytorch_half_pixel":

      \[\begin{eqnarray*} x_{input} = length_{output} > 1 ? (x_{output} + 0.5) * length_{input} / length_{output} - 0.5 : 0.0 \end{eqnarray*}\]
    • 'coordinate_transformation_mode'"coordinate_transformation_mode" = 'asymmetric'"asymmetric": The transformation is applied asymmetrically. Using the \(x\) axis as an example, this leads to:

      \[\begin{eqnarray*} x_{input} = x_{output} * length_{input} / length_{output} \end{eqnarray*}\]

The following generic parameters GenParamNamegenParamNamegen_param_name and the corresponding values GenParamValuegenParamValuegen_param_value are supported:

  • 'coordinate_transformation_mode'"coordinate_transformation_mode": Defines how coordinates are transformed from the output to the input image. If not specified, the parameter AlignCornersalignCornersalign_corners determines the transformation.

    Default: 'half_pixel'"half_pixel"

  • 'nearest_mode'"nearest_mode": Defines how to get the β€œnearest” pixel in the input image. This parameter only applies if Interpolationinterpolationinterpolation is set to 'nearest_neighbor'"nearest_neighbor".

    Suggested values: 'round_prefer_floor'"round_prefer_floor", 'round_prefer_ceil'"round_prefer_ceil", 'floor'"floor", 'ceil'"ceil"

    Default: 'round_prefer_floor'"round_prefer_floor"

  • 'is_inference_output'"is_inference_output": Determines whether apply_dl_modelApplyDlModel will include the output of this layer in the dictionary DLResultBatchDLResultBatchdlresult_batch even without specifying this layer in Outputsoutputsoutputs ('true'"true") or not ('false'"false").

    Default: 'false'"false"

Certain parameters of layers created using this operator create_dl_layer_zoom_factorCreateDlLayerZoomFactor can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramSetDlModelLayerParam and which ones can be retrieved using get_dl_model_layer_paramGetDlModelLayerParam or get_dl_layer_paramGetDlLayerParam. Note, the operators set_dl_model_layer_paramSetDlModelLayerParam and get_dl_model_layer_paramGetDlModelLayerParam require a model created by create_dl_modelCreateDlModel.

Layer Parameters set get
'align_corners'"align_corners" (AlignCornersalignCornersalign_corners) x x
'coordinate_transformation_mode'"coordinate_transformation_mode" x x
'input_layer'"input_layer" (DLLayerInputDLLayerInputdllayer_input) x
'interpolation_mode'"interpolation_mode" (Interpolationinterpolationinterpolation) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'nearest_mode'"nearest_mode" x x
'output_layer'"output_layer" (DLLayerZoomDLLayerZoomdllayer_zoom) x
'scale_params'"scale_params" (ScaleWidthscaleWidthscale_width and ScaleHeightscaleHeightscale_height) x
'shape'"shape" x
'type'"type" x
Generic Layer Parameters set get
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x

Execution informationπŸ”—

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πŸ”—

DLLayerInputDLLayerInputdllayer_input (input_control) dl_layer β†’ (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Feeding layer.

LayerNamelayerNamelayer_name (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the output layer.

ScaleWidthscaleWidthscale_width (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Ratio output/input width of the layer.

Default: 2.02.0

ScaleHeightscaleHeightscale_height (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Ratio output/input height of the layer.

Default: 2.02.0

Interpolationinterpolationinterpolation (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Mode of interpolation.

Default: 'bilinear'"bilinear"
List of values: 'bilinear', 'nearest_neighbor'"bilinear", "nearest_neighbor"

AlignCornersalignCornersalign_corners (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of coordinate transformation between output/input images.

Default: 'false'"false"
List of values: 'false', 'true'"false", "true"

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) β†’ (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Generic input parameter names.

Default: [][]
List of values: 'coordinate_transformation_mode', 'is_inference_output', 'nearest_mode'"coordinate_transformation_mode", "is_inference_output", "nearest_mode"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) β†’ (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Generic input parameter values.

Default: [][]
Suggested values: 'align_corners', 'asymmetric', 'pytorch_half_pixel', 'half_pixel', 'true', 'false', 'ceil', 'floor', 'round_prefer_ceil', 'round_prefer_floor'"align_corners", "asymmetric", "pytorch_half_pixel", "half_pixel", "true", "false", "ceil", "floor", "round_prefer_ceil", "round_prefer_floor"

DLLayerZoomDLLayerZoomdllayer_zoom (output_control) dl_layer β†’ (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Zoom layer.

Combinations with other operatorsπŸ”—

Combinations

Alternatives

create_dl_layer_zoom_sizeCreateDlLayerZoomSize, create_dl_layer_zoom_to_layer_sizeCreateDlLayerZoomToLayerSize

ModuleπŸ”—

Deep Learning Professional