123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- /***********************************************************
- * File generated by the HALCON-Compiler hcomp version 20.11
- * Usage: Interface to C++
- *
- * Software by: MVTec Software GmbH, www.mvtec.com
- ***********************************************************/
- #ifndef HCPP_HCLASSMLP
- #define HCPP_HCLASSMLP
- namespace HalconCpp
- {
- // Represents an instance of a multilayer perceptron.
- class LIntExport HClassMlp : public HHandle
- {
- public:
- // Create an uninitialized instance
- HClassMlp():HHandle() {}
- // Copy constructor
- HClassMlp(const HClassMlp& source) : HHandle(source) {}
- // Copy constructor
- HClassMlp(const HHandle& handle);
- // Create HClassMlp from handle, taking ownership
- explicit HClassMlp(Hlong handle);
- bool operator==(const HHandle& obj) const
- {
- return HHandleBase::operator==(obj);
- }
- bool operator!=(const HHandle& obj) const
- {
- return HHandleBase::operator!=(obj);
- }
- protected:
- // Verify matching semantic type ('class_mlp')!
- virtual void AssertType(Hphandle handle) const;
- public:
- // Deep copy of all data represented by this object instance
- HClassMlp Clone() const;
- /*****************************************************************************
- * Operator-based class constructors
- *****************************************************************************/
- // read_class_mlp: Read a multilayer perceptron from a file.
- explicit HClassMlp(const HString& FileName);
- // read_class_mlp: Read a multilayer perceptron from a file.
- explicit HClassMlp(const char* FileName);
- #ifdef _WIN32
- // read_class_mlp: Read a multilayer perceptron from a file.
- explicit HClassMlp(const wchar_t* FileName);
- #endif
- // create_class_mlp: Create a multilayer perceptron for classification or regression.
- explicit HClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const HString& OutputFunction, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // create_class_mlp: Create a multilayer perceptron for classification or regression.
- explicit HClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const char* OutputFunction, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #ifdef _WIN32
- // create_class_mlp: Create a multilayer perceptron for classification or regression.
- explicit HClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const wchar_t* OutputFunction, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #endif
- /***************************************************************************
- * Operators *
- ***************************************************************************/
- // Classify an image with a multilayer perceptron.
- HRegion ClassifyImageClassMlp(const HImage& Image, double RejectionThreshold) const;
- // Add training samples from an image to the training data of a multilayer perceptron.
- void AddSamplesImageClassMlp(const HImage& Image, const HRegion& ClassRegions) const;
- // Get the training data of a multilayer perceptron (MLP).
- HClassTrainData GetClassTrainDataMlp() const;
- // Add training data to a multilayer perceptron (MLP).
- void AddClassTrainDataMlp(const HClassTrainData& ClassTrainDataHandle) const;
- // Selects an optimal combination of features to classify the provided data.
- HTuple SelectFeatureSetMlp(const HClassTrainData& ClassTrainDataHandle, const HString& SelectionMethod, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score);
- // Selects an optimal combination of features to classify the provided data.
- HTuple SelectFeatureSetMlp(const HClassTrainData& ClassTrainDataHandle, const HString& SelectionMethod, const HString& GenParamName, double GenParamValue, HTuple* Score);
- // Selects an optimal combination of features to classify the provided data.
- HTuple SelectFeatureSetMlp(const HClassTrainData& ClassTrainDataHandle, const char* SelectionMethod, const char* GenParamName, double GenParamValue, HTuple* Score);
- #ifdef _WIN32
- // Selects an optimal combination of features to classify the provided data.
- HTuple SelectFeatureSetMlp(const HClassTrainData& ClassTrainDataHandle, const wchar_t* SelectionMethod, const wchar_t* GenParamName, double GenParamValue, HTuple* Score);
- #endif
- // Create a look-up table using a multi-layer perceptron to classify byte images.
- HClassLUT CreateClassLutMlp(const HTuple& GenParamName, const HTuple& GenParamValue) const;
- // Clear a multilayer perceptron.
- static void ClearClassMlp(const HClassMlpArray& MLPHandle);
- // Clear a multilayer perceptron.
- void ClearClassMlp() const;
- // Clear the training data of a multilayer perceptron.
- static void ClearSamplesClassMlp(const HClassMlpArray& MLPHandle);
- // Clear the training data of a multilayer perceptron.
- void ClearSamplesClassMlp() const;
- // Deserialize a serialized multilayer perceptron.
- void DeserializeClassMlp(const HSerializedItem& SerializedItemHandle);
- // Serialize a multilayer perceptron (MLP).
- HSerializedItem SerializeClassMlp() const;
- // Read a multilayer perceptron from a file.
- void ReadClassMlp(const HString& FileName);
- // Read a multilayer perceptron from a file.
- void ReadClassMlp(const char* FileName);
- #ifdef _WIN32
- // Read a multilayer perceptron from a file.
- void ReadClassMlp(const wchar_t* FileName);
- #endif
- // Write a multilayer perceptron to a file.
- void WriteClassMlp(const HString& FileName) const;
- // Write a multilayer perceptron to a file.
- void WriteClassMlp(const char* FileName) const;
- #ifdef _WIN32
- // Write a multilayer perceptron to a file.
- void WriteClassMlp(const wchar_t* FileName) const;
- #endif
- // Read the training data of a multilayer perceptron from a file.
- void ReadSamplesClassMlp(const HString& FileName) const;
- // Read the training data of a multilayer perceptron from a file.
- void ReadSamplesClassMlp(const char* FileName) const;
- #ifdef _WIN32
- // Read the training data of a multilayer perceptron from a file.
- void ReadSamplesClassMlp(const wchar_t* FileName) const;
- #endif
- // Write the training data of a multilayer perceptron to a file.
- void WriteSamplesClassMlp(const HString& FileName) const;
- // Write the training data of a multilayer perceptron to a file.
- void WriteSamplesClassMlp(const char* FileName) const;
- #ifdef _WIN32
- // Write the training data of a multilayer perceptron to a file.
- void WriteSamplesClassMlp(const wchar_t* FileName) const;
- #endif
- // Calculate the class of a feature vector by a multilayer perceptron.
- HTuple ClassifyClassMlp(const HTuple& Features, const HTuple& Num, HTuple* Confidence) const;
- // Calculate the class of a feature vector by a multilayer perceptron.
- Hlong ClassifyClassMlp(const HTuple& Features, const HTuple& Num, double* Confidence) const;
- // Calculate the evaluation of a feature vector by a multilayer perceptron.
- HTuple EvaluateClassMlp(const HTuple& Features) const;
- // Train a multilayer perceptron.
- double TrainClassMlp(Hlong MaxIterations, double WeightTolerance, double ErrorTolerance, HTuple* ErrorLog) const;
- // Compute the information content of the preprocessed feature vectors of a multilayer perceptron.
- HTuple GetPrepInfoClassMlp(const HString& Preprocessing, HTuple* CumInformationCont) const;
- // Compute the information content of the preprocessed feature vectors of a multilayer perceptron.
- HTuple GetPrepInfoClassMlp(const char* Preprocessing, HTuple* CumInformationCont) const;
- #ifdef _WIN32
- // Compute the information content of the preprocessed feature vectors of a multilayer perceptron.
- HTuple GetPrepInfoClassMlp(const wchar_t* Preprocessing, HTuple* CumInformationCont) const;
- #endif
- // Return the number of training samples stored in the training data of a multilayer perceptron.
- Hlong GetSampleNumClassMlp() const;
- // Return a training sample from the training data of a multilayer perceptron.
- HTuple GetSampleClassMlp(Hlong IndexSample, HTuple* Target) const;
- // Get the parameters of a rejection class.
- HTuple GetRejectionParamsClassMlp(const HTuple& GenParamName) const;
- // Get the parameters of a rejection class.
- HTuple GetRejectionParamsClassMlp(const HString& GenParamName) const;
- // Get the parameters of a rejection class.
- HTuple GetRejectionParamsClassMlp(const char* GenParamName) const;
- #ifdef _WIN32
- // Get the parameters of a rejection class.
- HTuple GetRejectionParamsClassMlp(const wchar_t* GenParamName) const;
- #endif
- // Set the parameters of a rejection class.
- void SetRejectionParamsClassMlp(const HTuple& GenParamName, const HTuple& GenParamValue) const;
- // Set the parameters of a rejection class.
- void SetRejectionParamsClassMlp(const HString& GenParamName, const HString& GenParamValue) const;
- // Set the parameters of a rejection class.
- void SetRejectionParamsClassMlp(const char* GenParamName, const char* GenParamValue) const;
- #ifdef _WIN32
- // Set the parameters of a rejection class.
- void SetRejectionParamsClassMlp(const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
- #endif
- // Add a training sample to the training data of a multilayer perceptron.
- void AddSampleClassMlp(const HTuple& Features, const HTuple& Target) const;
- // Add a training sample to the training data of a multilayer perceptron.
- void AddSampleClassMlp(const HTuple& Features, Hlong Target) const;
- // Return the regularization parameters of a multilayer perceptron.
- HTuple GetRegularizationParamsClassMlp(const HString& GenParamName) const;
- // Return the regularization parameters of a multilayer perceptron.
- HTuple GetRegularizationParamsClassMlp(const char* GenParamName) const;
- #ifdef _WIN32
- // Return the regularization parameters of a multilayer perceptron.
- HTuple GetRegularizationParamsClassMlp(const wchar_t* GenParamName) const;
- #endif
- // Set the regularization parameters of a multilayer perceptron.
- void SetRegularizationParamsClassMlp(const HString& GenParamName, const HTuple& GenParamValue) const;
- // Set the regularization parameters of a multilayer perceptron.
- void SetRegularizationParamsClassMlp(const HString& GenParamName, double GenParamValue) const;
- // Set the regularization parameters of a multilayer perceptron.
- void SetRegularizationParamsClassMlp(const char* GenParamName, double GenParamValue) const;
- #ifdef _WIN32
- // Set the regularization parameters of a multilayer perceptron.
- void SetRegularizationParamsClassMlp(const wchar_t* GenParamName, double GenParamValue) const;
- #endif
- // Return the parameters of a multilayer perceptron.
- Hlong GetParamsClassMlp(Hlong* NumHidden, Hlong* NumOutput, HString* OutputFunction, HString* Preprocessing, Hlong* NumComponents) const;
- // Create a multilayer perceptron for classification or regression.
- void CreateClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const HString& OutputFunction, const HString& Preprocessing, Hlong NumComponents, Hlong RandSeed);
- // Create a multilayer perceptron for classification or regression.
- void CreateClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const char* OutputFunction, const char* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #ifdef _WIN32
- // Create a multilayer perceptron for classification or regression.
- void CreateClassMlp(Hlong NumInput, Hlong NumHidden, Hlong NumOutput, const wchar_t* OutputFunction, const wchar_t* Preprocessing, Hlong NumComponents, Hlong RandSeed);
- #endif
- };
- // forward declarations and types for internal array implementation
- template<class T> class HSmartPtr;
- template<class T> class HHandleBaseArrayRef;
- typedef HHandleBaseArrayRef<HClassMlp> HClassMlpArrayRef;
- typedef HSmartPtr< HClassMlpArrayRef > HClassMlpArrayPtr;
- // Represents multiple tool instances
- class LIntExport HClassMlpArray : public HHandleBaseArray
- {
- public:
- // Create empty array
- HClassMlpArray();
- // Create array from native array of tool instances
- HClassMlpArray(HClassMlp* classes, Hlong length);
- // Copy constructor
- HClassMlpArray(const HClassMlpArray &tool_array);
- // Destructor
- virtual ~HClassMlpArray();
- // Assignment operator
- HClassMlpArray &operator=(const HClassMlpArray &tool_array);
- // Clears array and all tool instances
- virtual void Clear();
- // Get array of native tool instances
- const HClassMlp* Tools() const;
- // Get number of tools
- virtual Hlong Length() const;
- // Create tool array from tuple of handles
- virtual void SetFromTuple(const HTuple& handles);
- // Get tuple of handles for tool array
- virtual HTuple ConvertToTuple() const;
- protected:
- // Smart pointer to internal data container
- HClassMlpArrayPtr *mArrayPtr;
- };
- }
- #endif
|