1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Partially back-port #25075 to 4.x

This commit is contained in:
Alexander Smorkalov
2024-03-04 15:51:05 +03:00
parent ef611df09b
commit daa8f7dfc6
111 changed files with 1124 additions and 1124 deletions
+10 -10
View File
@@ -223,7 +223,7 @@ public:
void setActivationFunction(int _activ_func, double _f_param1, double _f_param2) CV_OVERRIDE
{
if( _activ_func < 0 || _activ_func > LEAKYRELU)
CV_Error( CV_StsOutOfRange, "Unknown activation function" );
CV_Error( cv::Error::StsOutOfRange, "Unknown activation function" );
activ_func = _activ_func;
@@ -322,7 +322,7 @@ public:
{
int n = layer_sizes[i];
if( n < 1 + (0 < i && i < l_count-1))
CV_Error( CV_StsOutOfRange,
CV_Error( cv::Error::StsOutOfRange,
"there should be at least one input and one output "
"and every hidden layer must have more than 1 neuron" );
max_lsize = std::max( max_lsize, n );
@@ -341,7 +341,7 @@ public:
float predict( InputArray _inputs, OutputArray _outputs, int ) const CV_OVERRIDE
{
if( !trained )
CV_Error( CV_StsError, "The network has not been trained or loaded" );
CV_Error( cv::Error::StsError, "The network has not been trained or loaded" );
Mat inputs = _inputs.getMat();
int type = inputs.type(), l_count = layer_count();
@@ -790,7 +790,7 @@ public:
{
t = t*inv_scale[j*2] + inv_scale[2*j+1];
if( t < m1 || t > M1 )
CV_Error( CV_StsOutOfRange,
CV_Error( cv::Error::StsOutOfRange,
"Some of new output training vector components run exceed the original range too much" );
}
}
@@ -817,25 +817,25 @@ public:
Mat& sample_weights, int flags )
{
if( layer_sizes.empty() )
CV_Error( CV_StsError,
CV_Error( cv::Error::StsError,
"The network has not been created. Use method create or the appropriate constructor" );
if( (inputs.type() != CV_32F && inputs.type() != CV_64F) ||
inputs.cols != layer_sizes[0] )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"input training data should be a floating-point matrix with "
"the number of rows equal to the number of training samples and "
"the number of columns equal to the size of 0-th (input) layer" );
if( (outputs.type() != CV_32F && outputs.type() != CV_64F) ||
outputs.cols != layer_sizes.back() )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"output training data should be a floating-point matrix with "
"the number of rows equal to the number of training samples and "
"the number of columns equal to the size of last (output) layer" );
if( inputs.rows != outputs.rows )
CV_Error( CV_StsUnmatchedSizes, "The numbers of input and output samples do not match" );
CV_Error( cv::Error::StsUnmatchedSizes, "The numbers of input and output samples do not match" );
Mat temp;
double s = sum(sample_weights)[0];
@@ -1323,7 +1323,7 @@ public:
fs << "itePerStep" << params.itePerStep;
}
else
CV_Error(CV_StsError, "Unknown training method");
CV_Error(cv::Error::StsError, "Unknown training method");
fs << "term_criteria" << "{";
if( params.termCrit.type & TermCriteria::EPS )
@@ -1421,7 +1421,7 @@ public:
params.itePerStep = tpn["itePerStep"];
}
else
CV_Error(CV_StsParseError, "Unknown training method (should be BACKPROP or RPROP)");
CV_Error(cv::Error::StsParseError, "Unknown training method (should be BACKPROP or RPROP)");
FileNode tcn = tpn["term_criteria"];
if( !tcn.empty() )