Operator description: Blends the input new background image with the existing image, and replaces the background with the new background by using mask.
Formula:
Each operator has calls. First, aclnnBackgroundReplaceGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnBackgroundReplace is called to perform computation.
[object Object][object Object]
Parameters:
- bkg (aclTensor*, compute input): aclTensor on the device. The data type can be UINT8 or FLOAT16, and the shape supports HWC (C = 1 or 3). Only contiguous tensors are supported. The can be ND.
- src (aclTensor*, compute input): aclTensor on the device. The data type can be UINT8 or FLOAT16, and the shape supports HWC (C = 1 or 3). Only contiguous tensors are supported. The can be ND.
- mask (aclTensor*, compute input): aclTensor on the device. The data type can be FLOAT16, and the shape supports HWC (C = 1). Only contiguous tensors are supported. The can be ND.
- out (aclTensor*, compute output): aclTensor on the device. The data type can be UINT8 or FLOAT16, and the shape supports HWC (C = 1 or 3). The data type and shape are the same as those of the input background image bkg. Only contiguous tensors are supported. The supports ND.
- workspaceSize (uint64_t *, output): size of the workspace to be allocated on the device.
- executor (aclOpExecutor **, output): operator executor, containing the operator computation process.
Returns:
[object Object]
Parameters:
- workspace (void *, input): address of the workspace to be allocated on the device.
- workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by calling the first-phase API aclnnBackgroundReplaceGetWorkspaceSize.
- executor (aclOpExecutor *, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computing:
- aclnnBackgroundReplace defaults to a deterministic implementation.
The following example is for reference only. For details, see .
[object Object]