FLImaging 6.7.1.4
ComputationalGraphObjectDetectionProcessor.h
1#pragma once
2
3#if _MSC_VER >= 1900 && defined(_M_X64)
4
5#include "DefinitionsAI.h"
6#include "ComputationalGraph.h"
7
8#include <vector>
9#include <utility>
10#include <functional>
11
12namespace FLImaging
13{
14 namespace AI
15 {
16 template <typename T>
17 class CObjectBox;
18
19 template <typename T>
20 class FL_EXPORT CComputationalGraphObjectDetectionProcessor : public CComputationalGraph<T>
21 {
22 protected:
23 CComputationalGraphObjectDetectionProcessor();
24 CComputationalGraphObjectDetectionProcessor(const CComputationalGraphObjectDetectionProcessor<T>& cg);
25
26 public:
27 CComputationalGraphObjectDetectionProcessor(const CComputationalBase<T>& cbOperand);
28 CComputationalGraphObjectDetectionProcessor(const std::initializer_list<const CComputationalBase<T>*>& cbOperands);
29 CComputationalGraphObjectDetectionProcessor(const std::vector<const CComputationalBase<T>*>& vctOperands);
30
31 virtual ~CComputationalGraphObjectDetectionProcessor();
32
33 virtual CTensor<T>& Forward() override;
34 virtual CTensor<T>* Backward() override;
35 virtual CComputationalBase<T>* Clone() const override;
36
37 virtual const std::vector<int64_t>& GetEstimatedShape(bool bRecursive = true) const override;
38
39 virtual const CResult SetNonMaximumSuppressionType(ENonMaximumSuppressionType eNMS = ENonMaximumSuppressionType_Greedy);
40 virtual ENonMaximumSuppressionType GetNonMaximumSuppressionType() const;
41 virtual const CResult SetBetaNMS(T tBetaNMS = .6);
42 virtual T GetBetaNMS() const;
43 virtual const CResult SetNMSIoUThreshold(T tNMSIoUThreshold = 0.45);
44 virtual T GetNMSIoUThreshold() const;
45 virtual const CResult SetObjectnessThreshold(T tObjectnessThreshold = .25);
46 virtual T GetObjectnessThreshold() const;
47
48 virtual const CResult GetResultBoxes(Foundation::CFLFigureArray& flfaResultBox) const;
49 virtual const CResult GetResultBoxes(Foundation::CFLFigureArray* pFlfaResultBox) const;
50
51 virtual const CResult GetResultBoxesWithScore(std::vector<std::vector<std::vector<std::tuple<CObjectBox<T>, T, int64_t>>>>& vct3BoxResult) const;
52
53
54 DeclareGetClassType();
55 SupportToDuplicateObjectWithoutCreateNewObject(CComputationalGraphObjectDetectionProcessor, *this);
56
57 public:
58 virtual const CResult PrintNodeParamInfo() const;
59
60 virtual const CResult GetBinaryData(Base::CFLData& fldBinary, bool bSuperClass = false, int32_t i32Version = -1, bool bDumpMode = false) const override;
61 virtual const CResult GetBinaryData(Base::CFLData* pFldBinary, bool bSuperClass = false, int32_t i32Version = -1, bool bDumpMode = false) const override;
62
63 virtual const CResult SetBinaryData(const Base::CFLData& fldBinary, int64_t* pI64Offset = nullptr) override;
64 virtual const CResult SetBinaryData(const Base::CFLData* pFldBinary, int64_t* pI64Offset = nullptr) override;
65
66 protected:
67 ENonMaximumSuppressionType m_eNMS;
68 T m_tBetaNMS;
69 T m_tNMSIoUThreshold;
70 T m_tObjectnessThreshold;
71 T* m_pTPredictionScore;
72 Foundation::CFLFigureArray m_flfaResultBox;
73 std::vector<std::vector<std::vector<std::tuple<CObjectBox<T>, T, int64_t>>>>& m_vct3ResultBox;
74
75 public:
76 DeclareGetSignletonObject(CComputationalGraphObjectDetectionProcessor);
77 };
78
79 #define CCGFDetection(...) (*(new CComputationalGraphObjectDetectionProcessor<float>(__VA_ARGS__)))
80 #define CCGDDetection(...) (*(new CComputationalGraphObjectDetectionProcessor<double>(__VA_ARGS__)))
81 #define CCGTDetection(T, ...) (*(new CComputationalGraphObjectDetectionProcessor<T>(__VA_ARGS__)))
82
83 }
84}
85
86#endif
Definition AlgorithmAIBase.h:16