aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/graph/backends
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2018-11-27 08:51:10 +0000
committerIsabella Gottardi <isabella.gottardi@arm.com>2018-12-13 11:21:59 +0000
commit7234ed8c3d07c76963eb3bce9530994421ad7e67 (patch)
tree6834d5fc3cc23eb47bcfad3a4191d91c87c8f9e0 /arm_compute/graph/backends
parent0e7210de821a7d1164017b8b9e11b53805185b25 (diff)
downloadComputeLibrary-7234ed8c3d07c76963eb3bce9530994421ad7e67.tar.gz
COMPMID-1808: Add Detection Output Layer to the GraphAPI
COMPMID-1710: Integrate Detection ouput in MobilenetSSD graph example Change-Id: I384d1eb492ef14ece58f2023ad7bbc16f834450b Reviewed-on: https://review.mlplatform.org/356 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/graph/backends')
-rw-r--r--arm_compute/graph/backends/FunctionHelpers.h45
-rw-r--r--arm_compute/graph/backends/ValidateHelpers.h24
2 files changed, 69 insertions, 0 deletions
diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h
index 3e71e3922a..96adffee46 100644
--- a/arm_compute/graph/backends/FunctionHelpers.h
+++ b/arm_compute/graph/backends/FunctionHelpers.h
@@ -489,6 +489,51 @@ std::unique_ptr<IFunction> create_depthwise_convolution_layer(DepthwiseConvoluti
return func;
}
+/** Create a backend detection output layer function
+ *
+ * @tparam DetectionOutputLayer Function Backend detection output function
+ * @tparam TargetInfo Target-specific information
+ *
+ * @param[in] node Node to create the backend function for
+ *
+ * @return Backend detection output layer function
+ */
+template <typename DetectionOutputLayerFunction, typename TargetInfo>
+std::unique_ptr<IFunction> create_detection_output_layer(DetectionOutputLayerNode &node)
+{
+ validate_node<TargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */);
+
+ // Extract IO and info
+ typename TargetInfo::TensorType *input0 = get_backing_tensor<TargetInfo>(node.input(0));
+ typename TargetInfo::TensorType *input1 = get_backing_tensor<TargetInfo>(node.input(1));
+ typename TargetInfo::TensorType *input2 = get_backing_tensor<TargetInfo>(node.input(2));
+ typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0));
+ const DetectionOutputLayerInfo detect_info = node.detection_output_info();
+
+ ARM_COMPUTE_ERROR_ON(input0 == nullptr);
+ ARM_COMPUTE_ERROR_ON(input1 == nullptr);
+ ARM_COMPUTE_ERROR_ON(input2 == nullptr);
+ ARM_COMPUTE_ERROR_ON(output == nullptr);
+
+ // Create and configure function
+ auto func = support::cpp14::make_unique<DetectionOutputLayerFunction>();
+ func->configure(input0, input1, input2, output, detect_info);
+
+ // Log info
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
+ << node.name()
+ << " Type: " << node.type()
+ << " Target: " << TargetInfo::TargetType
+ << " Data Type: " << input0->info()->data_type()
+ << " Input0 shape: " << input0->info()->tensor_shape()
+ << " Input1 shape: " << input1->info()->tensor_shape()
+ << " Input2 shape: " << input2->info()->tensor_shape()
+ << " Output shape: " << output->info()->tensor_shape()
+ << " DetectionOutputLayer info: " << detect_info
+ << std::endl);
+
+ return std::move(func);
+}
/** Create a backend element-wise operation layer function
*
* @tparam EltwiseFunctions Backend element-wise function
diff --git a/arm_compute/graph/backends/ValidateHelpers.h b/arm_compute/graph/backends/ValidateHelpers.h
index 75e2363f82..f1e53613ab 100644
--- a/arm_compute/graph/backends/ValidateHelpers.h
+++ b/arm_compute/graph/backends/ValidateHelpers.h
@@ -203,6 +203,30 @@ Status validate_depthwise_convolution_layer(DepthwiseConvolutionLayerNode &node)
return status;
}
+/** Validates a detection output layer node
+ *
+ * @tparam DetectionOutputLayer DetectionOutput layer type
+ *
+ * @param[in] node Node to validate
+ *
+ * @return Status
+ */
+template <typename DetectionOutputLayer>
+Status validate_detection_output_layer(DetectionOutputLayerNode &node)
+{
+ ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating DetectionOutputLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
+ ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 3);
+ ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1);
+
+ // Extract IO and info
+ arm_compute::ITensorInfo *input0 = get_backing_tensor_info(node.input(0));
+ arm_compute::ITensorInfo *input1 = get_backing_tensor_info(node.input(1));
+ arm_compute::ITensorInfo *input2 = get_backing_tensor_info(node.input(2));
+ arm_compute::ITensorInfo *output = get_backing_tensor_info(node.output(0));
+ const DetectionOutputLayerInfo detect_info = node.detection_output_info();
+
+ return DetectionOutputLayer::validate(input0, input1, input2, output, detect_info);
+}
/** Validates a Generate Proposals layer node
*