diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2019-01-08 13:48:44 +0000 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2019-08-06 07:58:16 +0000 |
commit | a7acb3cbabeb66ce647684466a04c96b2963c9c9 (patch) | |
tree | 7988b75372c8ad1dfa3c8d028ab3a603a5e5a047 /src/graph/backends | |
parent | 4746326ecb075dcfa123aaa8b38de5ec3e534b60 (diff) | |
download | ComputeLibrary-a7acb3cbabeb66ce647684466a04c96b2963c9c9.tar.gz |
COMPMID-1849: Implement CPPDetectionPostProcessLayer
* Add DetectionPostProcessLayer
* Add DetectionPostProcessLayer at the graph
Change-Id: I7e56f6cffc26f112d26dfe74853085bb8ec7d849
Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1639
Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/graph/backends')
-rw-r--r-- | src/graph/backends/CL/CLFunctionsFactory.cpp | 58 | ||||
-rw-r--r-- | src/graph/backends/CL/CLNodeValidator.cpp | 2 | ||||
-rw-r--r-- | src/graph/backends/GLES/GCNodeValidator.cpp | 2 | ||||
-rw-r--r-- | src/graph/backends/NEON/NEFunctionFactory.cpp | 2 | ||||
-rw-r--r-- | src/graph/backends/NEON/NENodeValidator.cpp | 2 |
5 files changed, 66 insertions, 0 deletions
diff --git a/src/graph/backends/CL/CLFunctionsFactory.cpp b/src/graph/backends/CL/CLFunctionsFactory.cpp index b9f22f6199..82b6dd6a54 100644 --- a/src/graph/backends/CL/CLFunctionsFactory.cpp +++ b/src/graph/backends/CL/CLFunctionsFactory.cpp @@ -166,6 +166,62 @@ std::unique_ptr<IFunction> create_detection_output_layer<CPPDetectionOutputLayer return std::move(wrap_function); } +template <> +std::unique_ptr<IFunction> create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(DetectionPostProcessLayerNode &node) +{ + validate_node<CLTargetInfo>(node, 3 /* expected inputs */, 4 /* expected outputs */); + + // Extract IO and info + CLTargetInfo::TensorType *input0 = get_backing_tensor<CLTargetInfo>(node.input(0)); + CLTargetInfo::TensorType *input1 = get_backing_tensor<CLTargetInfo>(node.input(1)); + CLTargetInfo::TensorType *input2 = get_backing_tensor<CLTargetInfo>(node.input(2)); + CLTargetInfo::TensorType *output0 = get_backing_tensor<CLTargetInfo>(node.output(0)); + CLTargetInfo::TensorType *output1 = get_backing_tensor<CLTargetInfo>(node.output(1)); + CLTargetInfo::TensorType *output2 = get_backing_tensor<CLTargetInfo>(node.output(2)); + CLTargetInfo::TensorType *output3 = get_backing_tensor<CLTargetInfo>(node.output(3)); + const DetectionPostProcessLayerInfo detect_info = node.detection_post_process_info(); + + ARM_COMPUTE_ERROR_ON(input0 == nullptr); + ARM_COMPUTE_ERROR_ON(input1 == nullptr); + ARM_COMPUTE_ERROR_ON(input2 == nullptr); + ARM_COMPUTE_ERROR_ON(output0 == nullptr); + ARM_COMPUTE_ERROR_ON(output1 == nullptr); + ARM_COMPUTE_ERROR_ON(output2 == nullptr); + ARM_COMPUTE_ERROR_ON(output3 == nullptr); + + // Create and configure function + auto func = support::cpp14::make_unique<CPPDetectionPostProcessLayer>(); + func->configure(input0, input1, input2, output0, output1, output2, output3, detect_info); + + // Log info + ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " + << node.name() + << " Type: " << node.type() + << " Target: " << CLTargetInfo::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() + << " Output0 shape: " << output0->info()->tensor_shape() + << " Output1 shape: " << output1->info()->tensor_shape() + << " Output2 shape: " << output2->info()->tensor_shape() + << " Output3 shape: " << output3->info()->tensor_shape() + << " DetectionPostProcessLayer info: " << detect_info + << std::endl); + + auto wrap_function = support::cpp14::make_unique<CPPWrapperFunction>(); + + wrap_function->register_function(std::move(func)); + wrap_function->register_tensor(input0); + wrap_function->register_tensor(input1); + wrap_function->register_tensor(input2); + wrap_function->register_tensor(output0); + wrap_function->register_tensor(output1); + wrap_function->register_tensor(output2); + wrap_function->register_tensor(output3); + + return std::move(wrap_function); +} } // namespace detail std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext &ctx) @@ -196,6 +252,8 @@ std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext & return detail::create_depthwise_convolution_layer<CLDepthwiseConvolutionLayerFunctions, CLTargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DetectionOutputLayer: return detail::create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + case NodeType::DetectionPostProcessLayer: + return detail::create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::EltwiseLayer: return detail::create_eltwise_layer<CLEltwiseFunctions, CLTargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::FlattenLayer: diff --git a/src/graph/backends/CL/CLNodeValidator.cpp b/src/graph/backends/CL/CLNodeValidator.cpp index 78771102e8..40ec508767 100644 --- a/src/graph/backends/CL/CLNodeValidator.cpp +++ b/src/graph/backends/CL/CLNodeValidator.cpp @@ -62,6 +62,8 @@ Status CLNodeValidator::validate(INode *node) CLDepthwiseConvolutionLayer3x3>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DetectionOutputLayer: return detail::validate_detection_output_layer<CPPDetectionOutputLayer>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + case NodeType::DetectionPostProcessLayer: + return detail::validate_detection_post_process_layer<CPPDetectionPostProcessLayer>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::GenerateProposalsLayer: return detail::validate_generate_proposals_layer<CLGenerateProposalsLayer>(*polymorphic_downcast<GenerateProposalsLayerNode *>(node)); case NodeType::NormalizePlanarYUVLayer: diff --git a/src/graph/backends/GLES/GCNodeValidator.cpp b/src/graph/backends/GLES/GCNodeValidator.cpp index a767d7b107..9cbb9a12ef 100644 --- a/src/graph/backends/GLES/GCNodeValidator.cpp +++ b/src/graph/backends/GLES/GCNodeValidator.cpp @@ -113,6 +113,8 @@ Status GCNodeValidator::validate(INode *node) return validate_depthwise_convolution_layer(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DetectionOutputLayer: return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : DetectionOutputLayer"); + case NodeType::DetectionPostProcessLayer: + return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : DetectionPostProcessLayer"); case NodeType::FlattenLayer: return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : FlattenLayer"); case NodeType::GenerateProposalsLayer: diff --git a/src/graph/backends/NEON/NEFunctionFactory.cpp b/src/graph/backends/NEON/NEFunctionFactory.cpp index b808ef81f9..852de549fa 100644 --- a/src/graph/backends/NEON/NEFunctionFactory.cpp +++ b/src/graph/backends/NEON/NEFunctionFactory.cpp @@ -215,6 +215,8 @@ std::unique_ptr<IFunction> NEFunctionFactory::create(INode *node, GraphContext & return detail::create_depthwise_convolution_layer<NEDepthwiseConvolutionLayerFunctions, NETargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DetectionOutputLayer: return detail::create_detection_output_layer<CPPDetectionOutputLayer, NETargetInfo>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + case NodeType::DetectionPostProcessLayer: + return detail::create_detection_post_process_layer<CPPDetectionPostProcessLayer, NETargetInfo>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::EltwiseLayer: return detail::create_eltwise_layer<NEEltwiseFunctions, NETargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::FlattenLayer: diff --git a/src/graph/backends/NEON/NENodeValidator.cpp b/src/graph/backends/NEON/NENodeValidator.cpp index 3b1d2aa59c..734b3401f7 100644 --- a/src/graph/backends/NEON/NENodeValidator.cpp +++ b/src/graph/backends/NEON/NENodeValidator.cpp @@ -62,6 +62,8 @@ Status NENodeValidator::validate(INode *node) NEDepthwiseConvolutionLayer3x3>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DetectionOutputLayer: return detail::validate_detection_output_layer<CPPDetectionOutputLayer>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + case NodeType::DetectionPostProcessLayer: + return detail::validate_detection_post_process_layer<CPPDetectionPostProcessLayer>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::GenerateProposalsLayer: return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : GenerateProposalsLayer"); case NodeType::NormalizePlanarYUVLayer: |