diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-06-27 12:34:20 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:10 +0000 |
commit | 7908de7ea914c1c968af01880357791a300483be (patch) | |
tree | 591445f3e351c4f8176c21cd11a7f31b8f574151 /utils/GraphUtils.h | |
parent | 9e454f36db4e13a3794289cb13e2cefbfbde1047 (diff) | |
download | ComputeLibrary-7908de7ea914c1c968af01880357791a300483be.tar.gz |
COMPMID-1309: Add result validation on full network validation
Change-Id: I5a7e2b198593c782eb812dd3f013ee2b91dc895f
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/137627
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'utils/GraphUtils.h')
-rw-r--r-- | utils/GraphUtils.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h index 349d8558fc..768c608d26 100644 --- a/utils/GraphUtils.h +++ b/utils/GraphUtils.h @@ -185,7 +185,7 @@ public: * @param[in] start (Optional) Start range * @param[in] end (Optional) End range * - * @note + * @note Range is defined as [start, end] */ ValidationInputAccessor(const std::string &image_list, std::string images_path, @@ -203,6 +203,49 @@ private: size_t _offset; }; +/** Output Accessor used for network validation */ +class ValidationOutputAccessor final : public graph::ITensorAccessor +{ +public: + /** Default Constructor + * + * @param[in] image_list File containing all the images and labels results + * @param[in] top_n (Optional) Top N accuracy (Defaults to 5) + * @param[out] output_stream (Optional) Output stream (Defaults to the standard output stream) + * @param[in] start (Optional) Start range + * @param[in] end (Optional) End range + * + * @note Range is defined as [start, end] + */ + ValidationOutputAccessor(const std::string &image_list, + size_t top_n = 5, + std::ostream &output_stream = std::cout, + unsigned int start = 0, + unsigned int end = 0); + /** Reset accessor state */ + void reset(); + + // Inherited methods overriden: + bool access_tensor(ITensor &tensor) override; + +private: + /** Access predictions of the tensor + * + * @tparam T Tensor elements type + * + * @param[in] tensor Tensor to read the predictions from + */ + template <typename T> + std::vector<size_t> access_predictions_tensor(ITensor &tensor); + +private: + std::vector<int> _results; + std::ostream &_output_stream; + size_t _top_n; + size_t _offset; + size_t _positive_samples; +}; + /** Result accessor class */ class TopNPredictionsAccessor final : public graph::ITensorAccessor { |