COMPMID-2257: Add support for QASYMM8 in NEGenerateProposals

Change-Id: I7d9aa21ecac97847fce209f97dff0dea6e62790a
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2020
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/arm_compute/core/NEON/kernels/NEGenerateProposalsLayerKernel.h b/arm_compute/core/NEON/kernels/NEGenerateProposalsLayerKernel.h
index a7b2603..9ee9d5d 100644
--- a/arm_compute/core/NEON/kernels/NEGenerateProposalsLayerKernel.h
+++ b/arm_compute/core/NEON/kernels/NEGenerateProposalsLayerKernel.h
@@ -53,7 +53,7 @@
 
     /** Set the input and output tensors.
      *
-     * @param[in]  anchors     Source tensor. Original set of anchors of size (4, A), where A is the number of anchors. Data types supported: F16/F32
+     * @param[in]  anchors     Source tensor. Original set of anchors of size (4, A), where A is the number of anchors. Data types supported: QSYMM16/F16/F32
      * @param[out] all_anchors Destination tensor. Destination anchors of size (4, H*W*A) where H and W are the height and width of the feature map and A is the number of anchors. Data types supported: Same as @p input
      * @param[in]  info        Contains Compute Anchors operation information described in @ref ComputeAnchorsInfo
      *
@@ -62,7 +62,7 @@
 
     /** Static function to check if given info will lead to a valid configuration of @ref NEComputeAllAnchorsKernel
      *
-     * @param[in] anchors     Source tensor info. Original set of anchors of size (4, A), where A is the number of anchors. Data types supported: F16/F32
+     * @param[in] anchors     Source tensor info. Original set of anchors of size (4, A), where A is the number of anchors. Data types supported: QSYMM16/F16/F32
      * @param[in] all_anchors Destination tensor info. Destination anchors of size (4, H*W*A) where H and W are the height and width of the feature map and A is the number of anchors. Data types supported: Same as @p input
      * @param[in] info        Contains Compute Anchors operation information described in @ref ComputeAnchorsInfo
      *
@@ -74,6 +74,9 @@
     void run(const Window &window, const ThreadInfo &info) override;
 
 private:
+    template <typename T>
+    void internal_run(const Window &window, const ThreadInfo &info);
+
     const ITensor     *_anchors;
     ITensor           *_all_anchors;
     ComputeAnchorsInfo _anchors_info;
diff --git a/arm_compute/core/NEON/kernels/NEStridedSliceKernel.h b/arm_compute/core/NEON/kernels/NEStridedSliceKernel.h
index a272a81..1207520 100644
--- a/arm_compute/core/NEON/kernels/NEStridedSliceKernel.h
+++ b/arm_compute/core/NEON/kernels/NEStridedSliceKernel.h
@@ -58,7 +58,7 @@
      *
      * @note Supported tensor rank: up to 4
      *
-     * @param[in]  input            Source tensor. Data type supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32
+     * @param[in]  input            Source tensor. Data type supported: U8/S8/QASYMM8/U16/S16/QASYMM16/QSYMM16/U32/S32/F16/F32
      * @param[out] output           Destination tensor. Data type supported: Same as @p input
      * @param[in]  starts           The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
      * @param[in]  ends             The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
@@ -76,7 +76,7 @@
      *
      * @note Supported tensor rank: up to 4
      *
-     * @param[in] input            Source tensor info. Data type supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32
+     * @param[in] input            Source tensor info. Data type supported: U8/S8/QASYMM8/U16/S16/QASYMM16/QSYMM16/U32/S32/F16/F32
      * @param[in] output           Destination tensor info. Data type supported: Same as @p input
      * @param[in] starts           The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
      * @param[in] ends             The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
diff --git a/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h b/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
index 827f19d..e14e195 100644
--- a/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
+++ b/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
@@ -50,7 +50,7 @@
  * -# @ref CLReshapeLayer x 2
  * -# @ref CLBoundingBoxTransform
  * -# @ref CLPadLayerKernel
- * -# @ref CLDequantizationLayerKernel
+ * -# @ref CLDequantizationLayerKernel x 2
  * -# @ref CLQuantizationLayerKernel
  * And the following CPP functions:
  * -# @ref CPPBoxWithNonMaximaSuppressionLimit
diff --git a/arm_compute/runtime/NEON/functions/NEGenerateProposalsLayer.h b/arm_compute/runtime/NEON/functions/NEGenerateProposalsLayer.h
index c6d3628..cd370a0 100644
--- a/arm_compute/runtime/NEON/functions/NEGenerateProposalsLayer.h
+++ b/arm_compute/runtime/NEON/functions/NEGenerateProposalsLayer.h
@@ -23,15 +23,16 @@
  */
 #ifndef __ARM_COMPUTE_NEGENERATEPROPOSALSLAYER_H__
 #define __ARM_COMPUTE_NEGENERATEPROPOSALSLAYER_H__
-#include "arm_compute/core/CPP/kernels/CPPBoxWithNonMaximaSuppressionLimitKernel.h"
 #include "arm_compute/core/NEON/kernels/NEBoundingBoxTransformKernel.h"
+#include "arm_compute/core/NEON/kernels/NEDequantizationLayerKernel.h"
 #include "arm_compute/core/NEON/kernels/NEGenerateProposalsLayerKernel.h"
 #include "arm_compute/core/NEON/kernels/NEPadLayerKernel.h"
 #include "arm_compute/core/NEON/kernels/NEPermuteKernel.h"
+#include "arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h"
 #include "arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h"
-#include "arm_compute/core/NEON/kernels/NEStridedSliceKernel.h"
 #include "arm_compute/core/Types.h"
 #include "arm_compute/runtime/CPP/CPPScheduler.h"
+#include "arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h"
 #include "arm_compute/runtime/IFunction.h"
 #include "arm_compute/runtime/MemoryGroup.h"
 #include "arm_compute/runtime/Tensor.h"
@@ -46,9 +47,10 @@
  * -# @ref NEComputeAllAnchors
  * -# @ref NEPermute x 2
  * -# @ref NEReshapeLayer x 2
- * -# @ref NEStridedSlice x 3
  * -# @ref NEBoundingBoxTransform
  * -# @ref NEPadLayerKernel
+ * -# @ref NEDequantizationLayerKernel x 2
+ * -# @ref NEQuantizationLayerKernel
  * And the following CPP kernels:
  * -# @ref CPPBoxWithNonMaximaSuppressionLimit
  */
@@ -71,10 +73,12 @@
 
     /** Set the input and output tensors.
      *
-     * @param[in]  scores              Scores from convolution layer of size (W, H, A), where H and W are the height and width of the feature map, and A is the number of anchors. Data types supported: F16/F32
+     * @param[in]  scores              Scores from convolution layer of size (W, H, A), where H and W are the height and width of the feature map, and A is the number of anchors.
+     *                                 Data types supported: QASYMM8/F16/F32
      * @param[in]  deltas              Bounding box deltas from convolution layer of size (W, H, 4*A). Data types supported: Same as @p scores
-     * @param[in]  anchors             Anchors tensor of size (4, A). Data types supported: Same as @p input
-     * @param[out] proposals           Box proposals output tensor of size (5, W*H*A). Data types supported: Same as @p input
+     * @param[in]  anchors             Anchors tensor of size (4, A). Data types supported: QSYMM16 with scale of 0.125 if @p scores is QASYMM8, otherwise same as @p scores
+     * @param[out] proposals           Box proposals output tensor of size (5, W*H*A).
+     *                                 Data types supported: QASYMM16 with scale of 0.125 and 0 offset if @p scores is QASYMM8, otherwise same as @p scores
      * @param[out] scores_out          Box scores output tensor of size (W*H*A). Data types supported: Same as @p input
      * @param[out] num_valid_proposals Scalar output tensor which says which of the first proposals are valid. Data types supported: U32
      * @param[in]  info                Contains GenerateProposals operation information described in @ref GenerateProposalsInfo
@@ -87,12 +91,14 @@
 
     /** Static function to check if given info will lead to a valid configuration of @ref NEGenerateProposalsLayer
      *
-     * @param[in] scores              Scores info from convolution layer of size (W, H, A), where H and W are the height and width of the feature map, and A is the number of anchors. Data types supported: F16/F32
+     * @param[in] scores              Scores info from convolution layer of size (W, H, A), where H and W are the height and width of the feature map, and A is the number of anchors.
+     *                                Data types supported: QASYMM8/F16/F32
      * @param[in] deltas              Bounding box deltas info from convolution layer of size (W, H, 4*A). Data types supported: Same as @p scores
-     * @param[in] anchors             Anchors tensor info of size (4, A). Data types supported: Same as @p input
-     * @param[in] proposals           Box proposals info  output tensor of size (5, W*H*A). Data types supported: Data types supported: U32
+     * @param[in] anchors             Anchors tensor info of size (4, A). Data types supported: QSYMM16 with scale of 0.125 if @p scores is QASYMM8, otherwise same as @p scores
+     * @param[in] proposals           Box proposals info  output tensor of size (5, W*H*A).
+     *                                Data types supported: QASYMM16 with scale of 0.125 and 0 offset if @p scores is QASYMM8, otherwise same as @p scores
      * @param[in] scores_out          Box scores output tensor info of size (W*H*A). Data types supported: Same as @p input
-     * @param[in] num_valid_proposals Scalar output tensor info which says which of the first proposals are valid. Data types supported: Same as @p input
+     * @param[in] num_valid_proposals Scalar output tensor info which says which of the first proposals are valid. Data types supported: U32
      * @param[in] info                Contains GenerateProposals operation information described in @ref GenerateProposalsInfo
      *
      * @return a Status
@@ -116,29 +122,36 @@
     NEComputeAllAnchorsKernel    _compute_anchors_kernel;
     NEBoundingBoxTransformKernel _bounding_box_kernel;
     NEPadLayerKernel             _pad_kernel;
+    NEDequantizationLayerKernel  _dequantize_anchors;
+    NEDequantizationLayerKernel  _dequantize_deltas;
+    NEQuantizationLayerKernel    _quantize_all_proposals;
 
-    // CPP kernels
-    CPPBoxWithNonMaximaSuppressionLimitKernel _cpp_nms_kernel;
+    // CPP functions
+    CPPBoxWithNonMaximaSuppressionLimit _cpp_nms;
 
     bool _is_nhwc;
+    bool _is_qasymm8;
 
     // Temporary tensors
     Tensor _deltas_permuted;
     Tensor _deltas_flattened;
+    Tensor _deltas_flattened_f32;
     Tensor _scores_permuted;
     Tensor _scores_flattened;
     Tensor _all_anchors;
+    Tensor _all_anchors_f32;
     Tensor _all_proposals;
+    Tensor _all_proposals_quantized;
     Tensor _keeps_nms_unused;
     Tensor _classes_nms_unused;
     Tensor _proposals_4_roi_values;
 
+    // Temporary tensor pointers
+    Tensor *_all_proposals_to_use;
+
     // Output tensor pointers
     ITensor *_num_valid_proposals;
     ITensor *_scores_out;
-
-    /** Internal function to run the CPP BoxWithNMS kernel */
-    void run_cpp_nms_kernel();
 };
 } // namespace arm_compute
 #endif /* __ARM_COMPUTE_NEGENERATEPROPOSALSLAYER_H__ */
diff --git a/src/core/NEON/kernels/NEGenerateProposalsLayerKernel.cpp b/src/core/NEON/kernels/NEGenerateProposalsLayerKernel.cpp
index 4a585b7..ba5ca78 100644
--- a/src/core/NEON/kernels/NEGenerateProposalsLayerKernel.cpp
+++ b/src/core/NEON/kernels/NEGenerateProposalsLayerKernel.cpp
@@ -30,6 +30,8 @@
 #include "arm_compute/core/Utils.h"
 #include "arm_compute/core/Window.h"
 
+#include <arm_neon.h>
+
 namespace arm_compute
 {
 namespace
@@ -39,7 +41,7 @@
     ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(anchors, all_anchors);
     ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(anchors);
     ARM_COMPUTE_RETURN_ERROR_ON(anchors->dimension(0) != info.values_per_roi());
-    ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(anchors, DataType::F16, DataType::F32);
+    ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(anchors, DataType::QSYMM16, DataType::F16, DataType::F32);
     ARM_COMPUTE_RETURN_ERROR_ON(anchors->num_dimensions() > 2);
     if(all_anchors->total_size() > 0)
     {
@@ -50,6 +52,11 @@
         ARM_COMPUTE_RETURN_ERROR_ON(all_anchors->num_dimensions() > 2);
         ARM_COMPUTE_RETURN_ERROR_ON(all_anchors->dimension(0) != info.values_per_roi());
         ARM_COMPUTE_RETURN_ERROR_ON(all_anchors->dimension(1) != feature_height * feature_width * num_anchors);
+
+        if(is_data_type_quantized(anchors->data_type()))
+        {
+            ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(anchors, all_anchors);
+        }
     }
     return Status{};
 }
@@ -74,7 +81,7 @@
 
     // Initialize the output if empty
     const TensorShape output_shape(info.values_per_roi(), width * height * num_anchors);
-    auto_init_if_empty(*all_anchors->info(), output_shape, 1, data_type);
+    auto_init_if_empty(*all_anchors->info(), TensorInfo(output_shape, 1, data_type, anchors->info()->quantization_info()));
 
     // Set instance variables
     _anchors      = anchors;
@@ -92,12 +99,9 @@
     return Status{};
 }
 
-void NEComputeAllAnchorsKernel::run(const Window &window, const ThreadInfo &info)
+template <>
+void NEComputeAllAnchorsKernel::internal_run<int16_t>(const Window &window, const ThreadInfo &info)
 {
-    ARM_COMPUTE_UNUSED(info);
-    ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
-    ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
-
     Iterator all_anchors_it(_all_anchors, window);
     Iterator anchors_it(_all_anchors, window);
 
@@ -105,27 +109,90 @@
     const float  stride      = 1.f / _anchors_info.spatial_scale();
     const size_t feat_width  = _anchors_info.feat_width();
 
+    const UniformQuantizationInfo qinfo = _anchors->info()->quantization_info().uniform();
+
     execute_window_loop(window, [&](const Coordinates & id)
     {
         const size_t anchor_offset = id.y() % num_anchors;
 
-        const auto out_anchor_ptr = reinterpret_cast<float *>(all_anchors_it.ptr());
-        const auto anchor_ptr     = reinterpret_cast<float *>(_anchors->ptr_to_element(Coordinates(0, anchor_offset)));
-
-        *out_anchor_ptr       = *anchor_ptr;
-        *(1 + out_anchor_ptr) = *(1 + anchor_ptr);
-        *(2 + out_anchor_ptr) = *(2 + anchor_ptr);
-        *(3 + out_anchor_ptr) = *(3 + anchor_ptr);
+        const auto out_anchor_ptr = reinterpret_cast<int16_t *>(all_anchors_it.ptr());
+        const auto anchor_ptr     = reinterpret_cast<int16_t *>(_anchors->ptr_to_element(Coordinates(0, anchor_offset)));
 
         const size_t shift_idy = id.y() / num_anchors;
         const float  shiftx    = (shift_idy % feat_width) * stride;
         const float  shifty    = (shift_idy / feat_width) * stride;
 
-        *out_anchor_ptr += shiftx;
-        *(out_anchor_ptr + 1) += shifty;
-        *(out_anchor_ptr + 2) += shiftx;
-        *(out_anchor_ptr + 3) += shifty;
+        const float new_anchor_x1 = dequantize_qsymm16(*anchor_ptr, qinfo.scale) + shiftx;
+        const float new_anchor_y1 = dequantize_qsymm16(*(1 + anchor_ptr), qinfo.scale) + shifty;
+        const float new_anchor_x2 = dequantize_qsymm16(*(2 + anchor_ptr), qinfo.scale) + shiftx;
+        const float new_anchor_y2 = dequantize_qsymm16(*(3 + anchor_ptr), qinfo.scale) + shifty;
+
+        *out_anchor_ptr       = quantize_qsymm16(new_anchor_x1, qinfo.scale);
+        *(out_anchor_ptr + 1) = quantize_qsymm16(new_anchor_y1, qinfo.scale);
+        *(out_anchor_ptr + 2) = quantize_qsymm16(new_anchor_x2, qinfo.scale);
+        *(out_anchor_ptr + 3) = quantize_qsymm16(new_anchor_y2, qinfo.scale);
     },
     all_anchors_it);
 }
+
+template <typename T>
+void NEComputeAllAnchorsKernel::internal_run(const Window &window, const ThreadInfo &info)
+{
+    Iterator all_anchors_it(_all_anchors, window);
+    Iterator anchors_it(_all_anchors, window);
+
+    const size_t num_anchors = _anchors->info()->dimension(1);
+    const T      stride      = 1.f / _anchors_info.spatial_scale();
+    const size_t feat_width  = _anchors_info.feat_width();
+
+    execute_window_loop(window, [&](const Coordinates & id)
+    {
+        const size_t anchor_offset = id.y() % num_anchors;
+
+        const auto out_anchor_ptr = reinterpret_cast<T *>(all_anchors_it.ptr());
+        const auto anchor_ptr     = reinterpret_cast<T *>(_anchors->ptr_to_element(Coordinates(0, anchor_offset)));
+
+        const size_t shift_idy = id.y() / num_anchors;
+        const T      shiftx    = (shift_idy % feat_width) * stride;
+        const T      shifty    = (shift_idy / feat_width) * stride;
+
+        *out_anchor_ptr       = *anchor_ptr + shiftx;
+        *(out_anchor_ptr + 1) = *(1 + anchor_ptr) + shifty;
+        *(out_anchor_ptr + 2) = *(2 + anchor_ptr) + shiftx;
+        *(out_anchor_ptr + 3) = *(3 + anchor_ptr) + shifty;
+    },
+    all_anchors_it);
+}
+
+void NEComputeAllAnchorsKernel::run(const Window &window, const ThreadInfo &info)
+{
+    ARM_COMPUTE_UNUSED(info);
+    ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
+    ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
+
+    switch(_anchors->info()->data_type())
+    {
+        case DataType::QSYMM16:
+        {
+            internal_run<int16_t>(window, info);
+            break;
+        }
+#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+        case DataType::F16:
+        {
+            internal_run<float16_t>(window, info);
+            break;
+        }
+#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+        case DataType::F32:
+        {
+            internal_run<float>(window, info);
+            break;
+        }
+        default:
+        {
+            ARM_COMPUTE_ERROR("Data type not supported");
+        }
+    }
+}
 } // namespace arm_compute
diff --git a/src/core/NEON/kernels/NEStridedSliceKernel.cpp b/src/core/NEON/kernels/NEStridedSliceKernel.cpp
index c33e699..2de49c6 100644
--- a/src/core/NEON/kernels/NEStridedSliceKernel.cpp
+++ b/src/core/NEON/kernels/NEStridedSliceKernel.cpp
@@ -45,7 +45,7 @@
     ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
     ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1,
                                                          DataType::U8, DataType::S8, DataType::QASYMM8,
-                                                         DataType::U16, DataType::S16, DataType::QSYMM16,
+                                                         DataType::U16, DataType::S16, DataType::QASYMM16, DataType::QSYMM16,
                                                          DataType::U32, DataType::S32,
                                                          DataType::F16, DataType::F32);
 
diff --git a/src/runtime/NEON/functions/NEGenerateProposalsLayer.cpp b/src/runtime/NEON/functions/NEGenerateProposalsLayer.cpp
index b2a6ca8..7f25b63 100644
--- a/src/runtime/NEON/functions/NEGenerateProposalsLayer.cpp
+++ b/src/runtime/NEON/functions/NEGenerateProposalsLayer.cpp
@@ -30,7 +30,7 @@
 namespace arm_compute
 {
 NEGenerateProposalsLayer::NEGenerateProposalsLayer(std::shared_ptr<IMemoryManager> memory_manager)
-    : _memory_group(std::move(memory_manager)),
+    : _memory_group(memory_manager),
       _permute_deltas_kernel(),
       _flatten_deltas_kernel(),
       _permute_scores_kernel(),
@@ -38,17 +38,25 @@
       _compute_anchors_kernel(),
       _bounding_box_kernel(),
       _pad_kernel(),
-      _cpp_nms_kernel(),
+      _dequantize_anchors(),
+      _dequantize_deltas(),
+      _quantize_all_proposals(),
+      _cpp_nms(memory_manager),
       _is_nhwc(false),
+      _is_qasymm8(false),
       _deltas_permuted(),
       _deltas_flattened(),
+      _deltas_flattened_f32(),
       _scores_permuted(),
       _scores_flattened(),
       _all_anchors(),
+      _all_anchors_f32(),
       _all_proposals(),
+      _all_proposals_quantized(),
       _keeps_nms_unused(),
       _classes_nms_unused(),
       _proposals_4_roi_values(),
+      _all_proposals_to_use(nullptr),
       _num_valid_proposals(nullptr),
       _scores_out(nullptr)
 {
@@ -60,25 +68,30 @@
     ARM_COMPUTE_ERROR_ON_NULLPTR(scores, deltas, anchors, proposals, scores_out, num_valid_proposals);
     ARM_COMPUTE_ERROR_THROW_ON(NEGenerateProposalsLayer::validate(scores->info(), deltas->info(), anchors->info(), proposals->info(), scores_out->info(), num_valid_proposals->info(), info));
 
-    _is_nhwc                         = scores->info()->data_layout() == DataLayout::NHWC;
-    const DataType data_type         = deltas->info()->data_type();
-    const int      num_anchors       = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::CHANNEL));
-    const int      feat_width        = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::WIDTH));
-    const int      feat_height       = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::HEIGHT));
-    const int      total_num_anchors = num_anchors * feat_width * feat_height;
-    const int      pre_nms_topN      = info.pre_nms_topN();
-    const int      post_nms_topN     = info.post_nms_topN();
-    const size_t   values_per_roi    = info.values_per_roi();
+    _is_nhwc                        = scores->info()->data_layout() == DataLayout::NHWC;
+    const DataType scores_data_type = scores->info()->data_type();
+    _is_qasymm8                     = scores_data_type == DataType::QASYMM8;
+    const int    num_anchors        = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::CHANNEL));
+    const int    feat_width         = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::WIDTH));
+    const int    feat_height        = scores->info()->dimension(get_data_layout_dimension_index(scores->info()->data_layout(), DataLayoutDimension::HEIGHT));
+    const int    total_num_anchors  = num_anchors * feat_width * feat_height;
+    const int    pre_nms_topN       = info.pre_nms_topN();
+    const int    post_nms_topN      = info.post_nms_topN();
+    const size_t values_per_roi     = info.values_per_roi();
+
+    const QuantizationInfo scores_qinfo   = scores->info()->quantization_info();
+    const DataType         rois_data_type = (_is_qasymm8) ? DataType::QASYMM16 : scores_data_type;
+    const QuantizationInfo rois_qinfo     = (_is_qasymm8) ? QuantizationInfo(0.125f, 0) : scores->info()->quantization_info();
 
     // Compute all the anchors
     _memory_group.manage(&_all_anchors);
     _compute_anchors_kernel.configure(anchors, &_all_anchors, ComputeAnchorsInfo(feat_width, feat_height, info.spatial_scale()));
 
     const TensorShape flatten_shape_deltas(values_per_roi, total_num_anchors);
-    _deltas_flattened.allocator()->init(TensorInfo(flatten_shape_deltas, 1, data_type));
-    _memory_group.manage(&_deltas_flattened);
+    _deltas_flattened.allocator()->init(TensorInfo(flatten_shape_deltas, 1, scores_data_type, deltas->info()->quantization_info()));
 
     // Permute and reshape deltas
+    _memory_group.manage(&_deltas_flattened);
     if(!_is_nhwc)
     {
         _memory_group.manage(&_deltas_permuted);
@@ -92,9 +105,10 @@
     }
 
     const TensorShape flatten_shape_scores(1, total_num_anchors);
-    _scores_flattened.allocator()->init(TensorInfo(flatten_shape_scores, 1, data_type));
-    _memory_group.manage(&_scores_flattened);
+    _scores_flattened.allocator()->init(TensorInfo(flatten_shape_scores, 1, scores_data_type, scores_qinfo));
+
     // Permute and reshape scores
+    _memory_group.manage(&_scores_flattened);
     if(!_is_nhwc)
     {
         _memory_group.manage(&_scores_permuted);
@@ -107,13 +121,40 @@
         _flatten_scores_kernel.configure(scores, &_scores_flattened);
     }
 
+    Tensor *anchors_to_use = &_all_anchors;
+    Tensor *deltas_to_use  = &_deltas_flattened;
+    if(_is_qasymm8)
+    {
+        _all_anchors_f32.allocator()->init(TensorInfo(_all_anchors.info()->tensor_shape(), 1, DataType::F32));
+        _deltas_flattened_f32.allocator()->init(TensorInfo(_deltas_flattened.info()->tensor_shape(), 1, DataType::F32));
+        _memory_group.manage(&_all_anchors_f32);
+        _memory_group.manage(&_deltas_flattened_f32);
+        // Dequantize anchors to float
+        _dequantize_anchors.configure(&_all_anchors, &_all_anchors_f32);
+        _all_anchors.allocator()->allocate();
+        anchors_to_use = &_all_anchors_f32;
+        // Dequantize deltas to float
+        _dequantize_deltas.configure(&_deltas_flattened, &_deltas_flattened_f32);
+        _deltas_flattened.allocator()->allocate();
+        deltas_to_use = &_deltas_flattened_f32;
+    }
     // Bounding box transform
     _memory_group.manage(&_all_proposals);
     BoundingBoxTransformInfo bbox_info(info.im_width(), info.im_height(), 1.f);
-    _bounding_box_kernel.configure(&_all_anchors, &_all_proposals, &_deltas_flattened, bbox_info);
-    _deltas_flattened.allocator()->allocate();
-    _all_anchors.allocator()->allocate();
+    _bounding_box_kernel.configure(anchors_to_use, &_all_proposals, deltas_to_use, bbox_info);
+    deltas_to_use->allocator()->allocate();
+    anchors_to_use->allocator()->allocate();
 
+    _all_proposals_to_use = &_all_proposals;
+    if(_is_qasymm8)
+    {
+        _memory_group.manage(&_all_proposals_quantized);
+        // Requantize all_proposals to QASYMM16 with 0.125 scale and 0 offset
+        _all_proposals_quantized.allocator()->init(TensorInfo(_all_proposals.info()->tensor_shape(), 1, DataType::QASYMM16, QuantizationInfo(0.125f, 0)));
+        _quantize_all_proposals.configure(&_all_proposals, &_all_proposals_quantized);
+        _all_proposals.allocator()->allocate();
+        _all_proposals_to_use = &_all_proposals_quantized;
+    }
     // The original layer implementation first selects the best pre_nms_topN anchors (thus having a lightweight sort)
     // that are then transformed by bbox_transform. The boxes generated are then fed into a non-sorting NMS operation.
     // Since we are reusing the NMS layer and we don't implement any CL/sort, we let NMS do the sorting (of all the input)
@@ -124,12 +165,12 @@
     _memory_group.manage(&_keeps_nms_unused);
 
     // Note that NMS needs outputs preinitialized.
-    auto_init_if_empty(*scores_out->info(), TensorShape(scores_nms_size), 1, data_type);
-    auto_init_if_empty(*_proposals_4_roi_values.info(), TensorShape(values_per_roi, scores_nms_size), 1, data_type);
-    auto_init_if_empty(*num_valid_proposals->info(), TensorShape(scores_nms_size), 1, DataType::U32);
+    auto_init_if_empty(*scores_out->info(), TensorShape(scores_nms_size), 1, scores_data_type, scores_qinfo);
+    auto_init_if_empty(*_proposals_4_roi_values.info(), TensorShape(values_per_roi, scores_nms_size), 1, rois_data_type, rois_qinfo);
+    auto_init_if_empty(*num_valid_proposals->info(), TensorShape(1), 1, DataType::U32);
 
     // Initialize temporaries (unused) outputs
-    _classes_nms_unused.allocator()->init(TensorInfo(TensorShape(scores_nms_size), 1, data_type));
+    _classes_nms_unused.allocator()->init(TensorInfo(TensorShape(scores_nms_size), 1, scores_data_type, scores_qinfo));
     _keeps_nms_unused.allocator()->init(*scores_out->info());
 
     // Save the output (to map and unmap them at run)
@@ -139,20 +180,20 @@
     _memory_group.manage(&_proposals_4_roi_values);
 
     const BoxNMSLimitInfo box_nms_info(0.0f, info.nms_thres(), scores_nms_size, false, NMSType::LINEAR, 0.5f, 0.001f, true, min_size_scaled, info.im_width(), info.im_height());
-    _cpp_nms_kernel.configure(&_scores_flattened /*scores_in*/,
-                              &_all_proposals /*boxes_in,*/,
-                              nullptr /* batch_splits_in*/,
-                              scores_out /* scores_out*/,
-                              &_proposals_4_roi_values /*boxes_out*/,
-                              &_classes_nms_unused /*classes*/,
-                              nullptr /*batch_splits_out*/,
-                              &_keeps_nms_unused /*keeps*/,
-                              num_valid_proposals /* keeps_size*/,
-                              box_nms_info);
+    _cpp_nms.configure(&_scores_flattened /*scores_in*/,
+                       _all_proposals_to_use /*boxes_in,*/,
+                       nullptr /* batch_splits_in*/,
+                       scores_out /* scores_out*/,
+                       &_proposals_4_roi_values /*boxes_out*/,
+                       &_classes_nms_unused /*classes*/,
+                       nullptr /*batch_splits_out*/,
+                       &_keeps_nms_unused /*keeps*/,
+                       num_valid_proposals /* keeps_size*/,
+                       box_nms_info);
 
     _keeps_nms_unused.allocator()->allocate();
     _classes_nms_unused.allocator()->allocate();
-    _all_proposals.allocator()->allocate();
+    _all_proposals_to_use->allocator()->allocate();
     _scores_flattened.allocator()->allocate();
 
     // Add the first column that represents the batch id. This will be all zeros, as we don't support multiple images
@@ -164,8 +205,10 @@
                                           const ITensorInfo *num_valid_proposals, const GenerateProposalsInfo &info)
 {
     ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(scores, deltas, anchors, proposals, scores_out, num_valid_proposals);
+    ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(scores, 1, DataType::QASYMM8, DataType::F16, DataType::F32);
     ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(scores, DataLayout::NCHW, DataLayout::NHWC);
     ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(scores, deltas);
+    ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(scores, deltas);
 
     const int num_anchors       = scores->dimension(get_data_layout_dimension_index(scores->data_layout(), DataLayoutDimension::CHANNEL));
     const int feat_width        = scores->dimension(get_data_layout_dimension_index(scores->data_layout(), DataLayoutDimension::WIDTH));
@@ -174,8 +217,17 @@
     const int total_num_anchors = num_anchors * feat_width * feat_height;
     const int values_per_roi    = info.values_per_roi();
 
+    const bool is_qasymm8 = scores->data_type() == DataType::QASYMM8;
+
     ARM_COMPUTE_RETURN_ERROR_ON(num_images > 1);
 
+    if(is_qasymm8)
+    {
+        ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(anchors, 1, DataType::QSYMM16);
+        const UniformQuantizationInfo anchors_qinfo = anchors->quantization_info().uniform();
+        ARM_COMPUTE_RETURN_ERROR_ON(anchors_qinfo.scale != 0.125f);
+    }
+
     TensorInfo all_anchors_info(anchors->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true));
     ARM_COMPUTE_RETURN_ON_ERROR(NEComputeAllAnchorsKernel::validate(anchors, &all_anchors_info, ComputeAnchorsInfo(feat_width, feat_height, info.spatial_scale())));
 
@@ -199,10 +251,32 @@
     TensorInfo proposals_4_roi_values(deltas->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true));
 
     ARM_COMPUTE_RETURN_ON_ERROR(NEReshapeLayerKernel::validate(&scores_permuted_info, &scores_flattened_info));
-    ARM_COMPUTE_RETURN_ON_ERROR(NEBoundingBoxTransformKernel::validate(&all_anchors_info, &proposals_4_roi_values, &deltas_flattened_info, BoundingBoxTransformInfo(info.im_width(), info.im_height(),
-                                                                       1.f)));
 
-    ARM_COMPUTE_RETURN_ON_ERROR(NEPadLayerKernel::validate(&proposals_4_roi_values, proposals, PaddingList{ { 1, 0 } }));
+    TensorInfo *proposals_4_roi_values_to_use = &proposals_4_roi_values;
+    TensorInfo  proposals_4_roi_values_quantized(deltas->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true));
+    proposals_4_roi_values_quantized.set_data_type(DataType::QASYMM16).set_quantization_info(QuantizationInfo(0.125f, 0));
+    if(is_qasymm8)
+    {
+        TensorInfo all_anchors_f32_info(anchors->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true).set_data_type(DataType::F32));
+        ARM_COMPUTE_RETURN_ON_ERROR(NEDequantizationLayerKernel::validate(&all_anchors_info, &all_anchors_f32_info));
+
+        TensorInfo deltas_flattened_f32_info(deltas->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true).set_data_type(DataType::F32));
+        ARM_COMPUTE_RETURN_ON_ERROR(NEDequantizationLayerKernel::validate(&deltas_flattened_info, &deltas_flattened_f32_info));
+
+        TensorInfo proposals_4_roi_values_f32(deltas->clone()->set_tensor_shape(TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(true).set_data_type(DataType::F32));
+        ARM_COMPUTE_RETURN_ON_ERROR(NEBoundingBoxTransformKernel::validate(&all_anchors_f32_info, &proposals_4_roi_values_f32, &deltas_flattened_f32_info,
+                                                                           BoundingBoxTransformInfo(info.im_width(), info.im_height(), 1.f)));
+
+        ARM_COMPUTE_RETURN_ON_ERROR(NEQuantizationLayerKernel::validate(&proposals_4_roi_values_f32, &proposals_4_roi_values_quantized));
+        proposals_4_roi_values_to_use = &proposals_4_roi_values_quantized;
+    }
+    else
+    {
+        ARM_COMPUTE_RETURN_ON_ERROR(NEBoundingBoxTransformKernel::validate(&all_anchors_info, &proposals_4_roi_values, &deltas_flattened_info,
+                                                                           BoundingBoxTransformInfo(info.im_width(), info.im_height(), 1.f)));
+    }
+
+    ARM_COMPUTE_RETURN_ON_ERROR(NEPadLayerKernel::validate(proposals_4_roi_values_to_use, proposals, PaddingList{ { 1, 0 } }));
 
     if(num_valid_proposals->total_size() > 0)
     {
@@ -216,7 +290,17 @@
         ARM_COMPUTE_RETURN_ERROR_ON(proposals->num_dimensions() > 2);
         ARM_COMPUTE_RETURN_ERROR_ON(proposals->dimension(0) != size_t(values_per_roi) + 1);
         ARM_COMPUTE_RETURN_ERROR_ON(proposals->dimension(1) != size_t(total_num_anchors));
-        ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(proposals, deltas);
+        if(is_qasymm8)
+        {
+            ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(proposals, 1, DataType::QASYMM16);
+            const UniformQuantizationInfo proposals_qinfo = proposals->quantization_info().uniform();
+            ARM_COMPUTE_RETURN_ERROR_ON(proposals_qinfo.scale != 0.125f);
+            ARM_COMPUTE_RETURN_ERROR_ON(proposals_qinfo.offset != 0);
+        }
+        else
+        {
+            ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(proposals, scores);
+        }
     }
 
     if(scores_out->total_size() > 0)
@@ -247,11 +331,22 @@
     NEScheduler::get().schedule(&_flatten_deltas_kernel, Window::DimY);
     NEScheduler::get().schedule(&_flatten_scores_kernel, Window::DimY);
 
+    if(_is_qasymm8)
+    {
+        NEScheduler::get().schedule(&_dequantize_anchors, Window::DimY);
+        NEScheduler::get().schedule(&_dequantize_deltas, Window::DimY);
+    }
+
     // Build the boxes
     NEScheduler::get().schedule(&_bounding_box_kernel, Window::DimY);
 
+    if(_is_qasymm8)
+    {
+        NEScheduler::get().schedule(&_quantize_all_proposals, Window::DimY);
+    }
+
     // Non maxima suppression
-    CPPScheduler::get().schedule(&_cpp_nms_kernel, Window::DimX);
+    _cpp_nms.run();
 
     // Add dummy batch indexes
     NEScheduler::get().schedule(&_pad_kernel, Window::DimY);
diff --git a/tests/validation/NEON/GenerateProposalsLayer.cpp b/tests/validation/NEON/GenerateProposalsLayer.cpp
index ea99bb3..4ca2d57 100644
--- a/tests/validation/NEON/GenerateProposalsLayer.cpp
+++ b/tests/validation/NEON/GenerateProposalsLayer.cpp
@@ -82,6 +82,8 @@
     ComputeAnchorsInfo(100U, 100U, 1. / 4.f),
 
 });
+
+constexpr AbsoluteTolerance<int16_t> tolerance_qsymm16(1);
 } // namespace
 
 TEST_SUITE(NEON)
@@ -395,9 +397,24 @@
 
 TEST_SUITE_END() // Float
 
+template <typename T>
+using NEComputeAllAnchorsQuantizedFixture = ComputeAllAnchorsQuantizedFixture<Tensor, Accessor, NEComputeAllAnchors, T>;
+
+TEST_SUITE(Quantized)
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(ComputeAllAnchors, NEComputeAllAnchorsQuantizedFixture<int16_t>, framework::DatasetMode::ALL,
+                       combine(combine(combine(framework::dataset::make("NumAnchors", { 2, 4, 8 }), ComputeAllInfoDataset),
+                                       framework::dataset::make("DataType", { DataType::QSYMM16 })),
+                               framework::dataset::make("QuantInfo", { QuantizationInfo(0.125f, 0) })))
+{
+    // Validate output
+    validate(Accessor(_target), _reference, tolerance_qsymm16);
+}
+TEST_SUITE_END() // QASYMM8
+TEST_SUITE_END() // Quantized
+
 TEST_SUITE_END() // GenerateProposals
 TEST_SUITE_END() // NEON
-
 } // namespace validation
 } // namespace test
 } // namespace arm_compute