Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / samples / calibration_tool / data_stats.h
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <vector>
8 #include <map>
9 #include <string>
10
11 struct TensorStatistic {
12     TensorStatistic(float* data, size_t count, size_t nbuckets = 1000);
13     float getMaxValue() const;
14     float getMinValue()const;
15 protected:
16     float _min;
17     float _max;
18 };
19
20 class AggregatedDataStats {
21 public:
22     void addTensorStatistics(const std::string& name, size_t channel, float* data, size_t count);
23     void addTensorStatistics(const std::string &name, size_t channel, uint8_t *data, size_t count);
24     void getDataMinMax(const std::string& name, size_t channel, float& min, float& max, float threshold);
25     size_t getNumberChannels(const std::string& name) const;
26     std::vector <std::string> registeredLayers();
27     void registerLayer(std::string layer);
28 protected:
29     std::map<std::string, std::map<size_t, std::vector<TensorStatistic> > > _data;
30 };
31