Read@CVL
Evaluation.h
Go to the documentation of this file.
1 /*******************************************************************************************************
2  ReadFramework is the basis for modules developed at CVL/TU Wien for the EU project READ.
3 
4  Copyright (C) 2016 Markus Diem <diem@caa.tuwien.ac.at>
5  Copyright (C) 2016 Stefan Fiel <fiel@caa.tuwien.ac.at>
6  Copyright (C) 2016 Florian Kleber <kleber@caa.tuwien.ac.at>
7 
8  This file is part of ReadFramework.
9 
10  ReadFramework is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  ReadFramework is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23  The READ project has received funding from the European Union’s Horizon 2020
24  research and innovation programme under grant agreement No 674943
25 
26  related links:
27  [1] http://www.caa.tuwien.ac.at/cvl/
28  [2] https://transkribus.eu/Transkribus/
29  [3] https://github.com/TUWien/
30  [4] http://nomacs.org
31  *******************************************************************************************************/
32 
33 #pragma once
34 
35 #include "BaseImageElement.h"
36 
37 #pragma warning(push, 0) // no warnings from includes
38 #include <QVector>
39 #pragma warning(pop)
40 
41 #pragma warning (disable: 4251) // inlined Qt functions in dll interface
42 
43 #ifndef DllCoreExport
44 #ifdef DLL_CORE_EXPORT
45 #define DllCoreExport Q_DECL_EXPORT
46 #else
47 #define DllCoreExport Q_DECL_IMPORT
48 #endif
49 #endif
50 
51 // Qt defines
52 
53 namespace rdf {
54 
55 // read defines
56 
62 
63 public:
64  EvalInfo(const QString& name = "unknown");
65 
66  void operator+=(const EvalInfo& o);
67 
68  void eval(int trueClassId, int predictedClassId, bool isBackground = false);
69 
70  void setName(const QString& name);
71  QString name() const;
72 
73  double accuracy() const;
74  double fscore() const;
75  double precision() const;
76  double recall() const;
77 
78  int count() const;
79 
80  static QString header();
81  QString toString() const;
82 
83 private:
84  int mTp = 0; // true positives
85  int mTn = 0; // true negative
86  int mFp = 0; // false positives
87  int mFn = 0; // false negatives
88 
89  QString mName;
90 };
91 
93 
94 public:
95  EvalInfoManager(const QVector<EvalInfo>& evals);
96 
97  bool write(const QString& filePath) const;
98  QString toString() const;
99 
100 private:
101  QVector<EvalInfo> mEvals;
102 
103  QByteArray toBuffer() const;
104 };
105 
106 }
Information class for SuperPixel labeling.
Definition: Evaluation.h:61
#define DllCoreExport
Definition: BaseImageElement.h:43
Definition: BaseImageElement.h:53
Definition: Evaluation.h:92
Definition: Algorithms.cpp:45