3#if _MSC_VER >= 1900 && defined(_M_X64)
5#include "TensorImages.h"
15 class FL_EXPORT CTensorImagesWithMaskLabels :
public CTensorImages<T>
18 CTensorImagesWithMaskLabels();
20 CTensorImagesWithMaskLabels(
const CTensorImagesWithMaskLabels<T>& tsr,
bool bDeepCopy =
true);
22 virtual ~CTensorImagesWithMaskLabels();
24 static const CResult GetClassNumFromImages(
const Base::CFLImage* pFli,
bool bMaskImage, Base::CFLArray<int32_t>& flaClassNum);
26 using CTensorImages<T>::Create;
27 virtual const CResult Create(
const std::vector<int64_t>& vctShape,
bool bOrderByDesc =
true,
bool bCudaAllocation =
true)
override;
28 virtual const CResult Create(
const Base::CFLImage* pFli,
bool bNormalize =
true, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr,
bool* pBAbort =
nullptr)
override;
29 virtual const CResult Create(
const Base::CFLImage* pFli,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod,
bool bROIExtraction,
bool bNormalize,
const Base::CMultiVar<T>& mvBlankColor, ImageProcessing::EInterpolationMethod eInterpolationMethod, CTensorImages<T>::ETilingMode eTilingMode,
double f64PreScaleRatio, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex,
bool* pBAbort)
override;
30 virtual const CResult Create(
const Base::CFLImage& fli,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod = EResizeMethod_ScaleAllAxises,
bool bROIExtraction =
false,
bool bNormalize =
true,
const Base::CMultiVar<T>& mvBlankColor = 0., ImageProcessing::EInterpolationMethod eInterpolationMethod = ImageProcessing::EInterpolationMethod_Bilinear, CTensorImages<T>::ETilingMode eTilingMode = CTensorImages<T>::ETilingMode_NoTiling_Fit,
double f64PreScaleRatio = 1.,
bool bMaskFigureLabels =
false, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingMaskIndex =
nullptr,
bool* pBAbort =
nullptr);
31 virtual const CResult Create(
const Base::CFLImage* pFli,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod = EResizeMethod_ScaleAllAxises,
bool bROIExtraction =
false,
bool bNormalize =
true,
const Base::CMultiVar<T>& mvBlankColor = 0., ImageProcessing::EInterpolationMethod eInterpolationMethod = ImageProcessing::EInterpolationMethod_Bilinear, CTensorImages<T>::ETilingMode eTilingMode = CTensorImages<T>::ETilingMode_NoTiling_Fit,
double f64PreScaleRatio = 1.,
bool bMaskFigureLabels =
false, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingMaskIndex =
nullptr,
bool* pBAbort =
nullptr);
33 virtual const CResult Create(
const wchar_t* pWcFilePath,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod = EResizeMethod_ScaleAllAxises,
bool bROIExtraction =
false,
bool bNormalize =
true,
const Base::CMultiVar<T>& mvBlankColor = 0.,
bool bRecursive =
false, ImageProcessing::EInterpolationMethod eInterpolationMethod = ImageProcessing::EInterpolationMethod_Bilinear, CTensorImages<T>::ETilingMode eTilingMode = CTensorImages<T>::ETilingMode_NoTiling_Fit,
double f64PreScaleRatio = 1.)
override;
35 virtual const CResult
Assign(
const CTensor<T>* pTsr,
bool bDeepCopy =
true)
override;
36 virtual const CResult
Assign(
const CTensorImages<T>* pTsr,
bool bDeepCopy =
true)
override;
38 virtual const CResult
Assign(
const CTensorImagesWithMaskLabels<T>& tsr,
bool bDeepCopy =
true);
39 virtual const CResult
Assign(
const CTensorImagesWithMaskLabels<T>* pTsr,
bool bDeepCopy =
true);
41 virtual const CResult
Append(
const Base::CFLImage* pFli, EResizeMethod eResizeMethod = EResizeMethod_ScaleAllAxises,
bool bROIExtraction =
false,
bool bNormalize =
true,
const Base::CMultiVar<T>& mvBlankColor = 0., ImageProcessing::EInterpolationMethod eInterpolationMethod = ImageProcessing::EInterpolationMethod_Bilinear, CTensorImages<T>::ETilingMode eTilingMode = CTensorImages<T>::ETilingMode_NoTiling_Fit,
double f64PreScaleRatio = 1., std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr,
bool* pBAbort =
nullptr)
override;
43 virtual const CResult
Append(
const wchar_t* pWcFilePath,
bool bRecursive =
false)
override;
45 using CTensor<T>::GetBinaryData;
46 virtual const CResult GetBinaryData(Base::CFLData* pFldBinary,
bool bSuperClass =
false, int32_t i32Version = -1,
bool bDumpMode =
false)
const override;
48 using CTensor<T>::SetBinaryData;
49 virtual const CResult SetBinaryData(
const Base::CFLData* pFldBinary, int64_t* pI64Offset =
nullptr)
override;
51 virtual const CResult
Clear()
override;
53 virtual const CResult SetMaskLabelImage(
const Base::CFLImage& fliMaskLabelImage);
54 virtual const CResult SetMaskLabelImage(
const Base::CFLImage* pFliMaskLabelImage);
55 virtual const Base::CFLImage* GetMaskLabelImage()
const;
57 virtual const CResult SetBatchParameters(
const CTensorImages<T>& tsr)
override;
58 virtual const CResult SetBatchParameters(
const CTensorImagesWithMaskLabels<T>& tsr);
60 virtual CTensorImagesWithMaskLabels<T>& Evaluate()
override;
61 virtual CComputationalBase<T>* Clone()
const override;
63 virtual const CResult Swap(CComputationalBase<T>& cbSwap)
override;
65 virtual const CResult LoadTensor(
const std::vector<int64_t>& vctBatchIndices)
override;
66 virtual const CResult CopyMaskLabels(CTensorImagesWithMaskLabels<T>* pTsrOrg, std::vector<int64_t>& vctOrders);
68 virtual const Base::CFLImage* GetCurrentMaskLabels()
const;
69 virtual const Foundation::CFLFigureArray* GetCurrentMaskFigureLabels()
const;
71 virtual const CResult EnableMaskLabelImage(
bool bEnable);
72 virtual bool IsMaskLabelImageEnabled()
const;
74 virtual const CResult EnableMaskTensor(
bool bEnable);
75 virtual bool IsMaskTensorEnabled()
const;
77 virtual const CResult EnableMaskFigureLabels(
bool bEnable);
78 virtual bool IsMaskFigureLabelsEnabled()
const;
80 virtual const CResult CreateLabelImage(
const Base::CFLImage* pFliSrc,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod, CTensorImages<T>::ETilingMode eTilingMode,
double f64PreScaleRatio,
bool bAppend =
false,
bool bMaskFigureLabels =
false, std::atomic<int32_t>* pI32CurrentPreparingMaskIndex =
nullptr,
bool* pBAbort =
nullptr, Base::CFLImage* pFliDst =
nullptr);
82 virtual const CResult GetLabelRatio(std::vector<float>& vctLabelRatio);
83 virtual const CResult GetLabelRatioSum(std::vector<float>& vctLabelRatioSum);
84 virtual const CResult GetLabelCount(std::vector<int32_t>& vctLabelCount);
86 virtual const CResult EnableLabelIncludingOutline(
bool bEnable);
87 virtual bool IsLabelIncludingOutlineEnabled()
const;
89 virtual const CResult SetLabelOutlineThickness(
float f32Thickness);
90 virtual float GetLabelOutlineThickness()
const;
92 virtual const CResult SetLabelIncludingContourNum(int32_t i32LabelNum);
93 virtual int32_t GettLabelIncludingContourNum()
const;
95 virtual const CResult SetZeroLabelFigureConvertNum(int32_t i32LabelNum);
96 virtual int32_t GetZeroLabelFigureConvertNum()
const;
98 virtual const CResult GetFigureMaskLabels(Foundation::CFLFigureArray& flaResult);
99 virtual const Base::CFLImage* GetMaskLabels()
const;
101 DeclareGetClassType();
102 SupportToDuplicateObject(CTensorImagesWithMaskLabels, *
this);
105 virtual const CResult DecodeLabels(
const wchar_t* pWcsImagePath, Base::CFLImage* pFli =
nullptr);
106 virtual const CResult MakeDistribution()
override;
107 virtual const CResult InternalCreateLabelImage(
const std::vector<int64_t>& vctBatchIndices,
const Base::CFLImage* pFliSrc,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod,
bool bAppend =
false,
bool bMaskFigureLabels =
false, std::atomic<int32_t>* pI32CurrentPreparingMaskIndex =
nullptr,
bool* pBAbort =
nullptr, Base::CFLImage* pFliDst =
nullptr);
110 Base::CFLImage* m_pFliMaskLabelImage;
111 Base::CFLImage m_fliMaskLabels;
112 Base::CFLImage m_fliCurrentMaskLabels;
113 Base::CFLImage m_fliMaskLabelThreadBuffer;
114 Foundation::CFLFigureArray m_flfaMaskFigureLabels;
115 Foundation::CFLFigureArray m_flfaCurrentMaskFigureLabels;
117 std::vector<float>& m_vctLabelRatio;
118 std::vector<float>& m_vctLabelRatioSum;
119 std::vector<int32_t>& m_vctLabelCount;
121 std::bitset<1024>& m_bsLabels;
123 bool m_bMaskFigureLabels;
125 bool m_bClearMaskLabel;
127 bool m_bLabelIncludingOutline;
128 float m_f32LabelIncludingOutlineThickness;
129 int32_t m_i32LabelIncludingContourNum;
130 int32_t m_i32ZeroFigureLabel;
131 int32_t m_i32ZeroLabelFigureConvertNum;
135 friend class CClassEqualizerBase;
138 friend class CClassEqualizerForTensorImagesWithMaskLabels;
140 static CTensorImagesWithMaskLabels<T>* GetInstance();
142 DeclareGetSignletonObject(CTensorImagesWithMaskLabels);
145 #define CCGFTensorLabelsWithMaskLabels(...) (*(new CTensorImagesWithMaskLabels<float>(__VA_ARGS__)))
146 #define CCGDTensorLabelsWithMaskLabels(...) (*(new CTensorImagesWithMaskLabels<double>(__VA_ARGS__)))
148 typedef CTensorImagesWithMaskLabels<float> CTensorImagesWithMaskLabelsF;
149 typedef CTensorImagesWithMaskLabels<double> CTensorImagesWithMaskLabelsD;
Definition AlgorithmAIBase.h:18
@ Assign
Set the value of CGUIPropertyItemView3DFigure to the specified figure.
Definition DefinitionsGUIView3D.h:3401
@ Clear
Clear all the figure objects.
Definition DefinitionsGUI.h:2257
@ Append
Load and append.
Definition DefinitionsGUI.h:58