3#if _MSC_VER >= 1900 && defined(_M_X64)
5#include "TensorImages.h"
16 class FL_EXPORT CTensorLabels :
public CTensorImages<T>
21 CTensorLabels(
const CTensorLabels<T>& tsr,
bool bDeepCopy =
true);
23 virtual ~CTensorLabels();
25 virtual const CResult GetBinaryData(Base::CFLData& fldBinary,
bool bSuperClass =
false, int32_t i32Version = -1,
bool bDumpMode =
false)
const override;
26 virtual const CResult GetBinaryData(Base::CFLData* pFldBinary,
bool bSuperClass =
false, int32_t i32Version = -1,
bool bDumpMode =
false)
const override;
28 virtual const CResult SetBinaryData(
const Base::CFLData& fldBinary, int64_t* pI64Offset =
nullptr)
override;
29 virtual const CResult SetBinaryData(
const Base::CFLData* pFldBinary, int64_t* pI64Offset =
nullptr)
override;
31 virtual const CResult Create(
const std::vector<int64_t>& vctShape,
bool bOrderByDesc =
true,
bool bCudaAllocation =
true)
override;
32 virtual const CResult Create(
const std::initializer_list<int64_t>& ilShape,
bool bOrderByDesc =
true,
bool bCudaAllocation =
true)
override;
33 virtual const CResult Create(
const Base::CFLImage& fli,
const std::vector<int64_t>& vctNewSize, EResizeMethod eResizeMethod,
bool bROIExtraction,
bool bNormalize,
const Base::CMultiVar<T>& mvBlankColor, ImageProcessing::EInterpolationMethod eInterpolationMethod, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex,
bool* pBAbort)
override;
34 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, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex,
bool* pBAbort)
override;
35 virtual const CResult Create(
const Base::CFLImage& fli,
bool bNormalize =
true, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
36 virtual const CResult Create(
const Base::CFLImage* pFli,
bool bNormalize =
true, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
37 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, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
38 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, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
41 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);
42 virtual const CResult Create(
const wchar_t* pWcFilePath,
const std::initializer_list<int64_t>& ilNewSize, 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);
44 virtual const CResult
Assign(
const CTensor<T>* pTsr,
bool bDeepCopy =
true)
override;
45 virtual const CResult
Assign(
const CTensorImages<T>* pTsr,
bool bDeepCopy =
true)
override;
47 virtual const CResult
Assign(
const CTensorLabels<T>& tsr,
bool bDeepCopy =
true);
48 virtual const CResult
Assign(
const CTensorLabels<T>* pTsr,
bool bDeepCopy =
true);
50 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, std::atomic<int32_t>* pI32CurrentPreparingTensorIndex =
nullptr, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
52 virtual const CResult
Append(
const wchar_t* pWcFilePath,
bool bRecursive =
false)
override;
54 virtual const CResult Initialize()
override;
55 virtual const CResult
Clear()
override;
57 virtual const CResult SetBatchParameters(
const CTensorImages<T>& tsr)
override;
58 virtual const CResult SetBatchParameters(
const CTensorLabels<T>& tsr);
59 virtual const CResult EnableTrainingMode(
bool bMode,
bool bRecursively =
true)
override;
61 virtual CTensorLabels<T>& Evaluate()
override;
62 virtual CComputationalBase<T>* Clone()
const override;
64 virtual const CResult Swap(CComputationalBase<T>& cbSwap)
override;
66 virtual const CResult LoadTensor(
const std::vector<int64_t>& vctBatchIndices)
override;
68 virtual const CResult ConvertClassNumToLabel(
bool bIncludingClassName =
true)
override;
69 virtual const CResult ConvertLabelToClassNum(
bool bIncludingClassName =
true)
override;
72 static const CResult ExtractClassNumClassName(
const Base::CFLImage& fliSrc, Base::CFLArray<Base::CFLArray<int32_t>>& fla2ClassNum, Base::CFLArray<Base::CFLArray<Base::CFLString<wchar_t>>>& fla2ClassName);
73 static const CResult ExtractClassNumClassName(
const Base::CFLImage* pFliSrc, Base::CFLArray<Base::CFLArray<int32_t>>& fla2ClassNum, Base::CFLArray<Base::CFLArray<Base::CFLString<wchar_t>>>& fla2ClassName);
75 DeclareGetClassType();
76 SupportToDuplicateObject(CTensorLabels, *
this);
78 virtual const CResult IsValidImageFormat(EImageType eImageType)
const override;
79 virtual const CResult DecodeLabels(
const wchar_t* pWcsImagePath, Base::CFLImage* pFli =
nullptr)
override;
80 virtual const CResult CropImage(
const Base::CFLImage* pFliSrc, Base::CFLImage* pFliDst, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
81 virtual const CResult InternalCropImage(
const std::vector<int64_t>& vctBatchIndices,
const Base::CFLImage* pFliSrc, Base::CFLImage* pFliDst, std::atomic<int32_t>* pI32CurrentPreparingLabelIndex =
nullptr,
bool* pBAbort =
nullptr);
84 Foundation::CFLFigureArray m_flfaCroppedLabels;
85 std::vector<std::pair<int64_t, std::vector<int32_t>>>& m_vctLabelCount;
86 std::vector<std::pair<int64_t, std::vector<int32_t>>>& m_vctCumulativeLabelCount;
89 friend class CValidationImageExtractorDL;
91 DeclareGetSignletonObject(CTensorLabels);
94 #define CCGFTensorLabels(...) (*(new CTensorLabels<float>(__VA_ARGS__)))
95 #define CCGDTensorLabels(...) (*(new CTensorLabels<double>(__VA_ARGS__)))
97 typedef CTensorLabels<float> CTensorLabelsF;
98 typedef CTensorLabels<double> CTensorLabelsD;
Definition AlgorithmAIBase.h:18
@ Assign
Set the value of CGUIPropertyItemView3DFigure to the specified figure.
Definition DefinitionsGUIView3D.h:3531
@ Clear
Clear all the figure objects.
Definition DefinitionsGUI.h:5083
@ Append
Load and append.
Definition DefinitionsGUI.h:58