Skip to content
Snippets Groups Projects
Commit 6aed19c6 authored by Julien Michel's avatar Julien Michel
Browse files

Mise en commentaire des logs trop verbeux, et passage des otbMsgDevMacro en otbMsgDebugMacro.

parent feda0ba9
No related branches found
No related tags found
No related merge requests found
......@@ -57,13 +57,13 @@ SVMClassifier< TSample, TLabel >
// SVMClassifier< TSample, TLabel >
// ::SetSample(const TSample* sample)
// {
// otbMsgDevMacro( << "SVMClassifier::SetSample enter" );
// otbMsgDebugMacro( << "SVMClassifier::SetSample enter" );
// if ( m_Sample != sample )
// {
// m_Sample = sample ;
// m_Output->SetSample(sample) ;
// }
// otbMsgDevMacro( << "SVMClassifier::SetSample exit" );
// otbMsgDebugMacro( << "SVMClassifier::SetSample exit" );
// }
// template< class TSample, class TLabel >
......@@ -100,25 +100,25 @@ SVMClassifier< TSample, TLabel >
{
otbMsgDevMacro( << "Before Resize 0" );
// otbMsgDebugMacro( << "Before Resize 0" );
/* unsigned int i ;
typename TSample::ConstIterator iter = this->GetSample()->Begin() ;
typename TSample::ConstIterator end = this->GetSample()->End() ;
typename TSample::MeasurementVectorType measurements ;
*/
otbMsgDevMacro( << "Before Resize " );
// otbMsgDebugMacro( << "Before Resize " );
m_Output->SetSample(this->GetSample()) ;
otbMsgDevMacro( << "m_Output " << m_Output );
otbMsgDebugMacro( << "m_Output " << m_Output );
m_Output->Resize( this->GetSample()->Size() ) ;
otbMsgDevMacro( << "Resize to " << this->GetSample()->Size() );
otbMsgDevMacro( << "Resize to " << m_Output->GetSample()->Size() );
otbMsgDebugMacro( << "Resize to " << this->GetSample()->Size() );
otbMsgDebugMacro( << "Resize to " << m_Output->GetSample()->Size() );
//std::vector< double > discriminantScores ;
unsigned int numberOfClasses = this->GetNumberOfClasses() ;
otbMsgDevMacro( << "NbClass " << numberOfClasses );
otbMsgDebugMacro( << "NbClass " << numberOfClasses );
//discriminantScores.resize(numberOfClasses) ;
//unsigned int classLabel ;
......@@ -128,9 +128,9 @@ SVMClassifier< TSample, TLabel >
/*typename Superclass::DecisionRuleType::Pointer rule =
this->GetDecisionRule() ;*/
otbMsgDevMacro( << "Do Classif " );
otbMsgDebugMacro( << "Do Classif " );
this->DoClassification();
otbMsgDevMacro( << "End of classif" );
otbMsgDebugMacro( << "End of classif" );
// if ( m_ClassLabels.size() != this->GetNumberOfMembershipFunctions() )
// {
......@@ -203,7 +203,7 @@ SVMClassifier< TSample, TLabel >
x = new svm_node[numberOfComponentsPerSample+1];//m_Model->GetXSpace();
otbMsgDevMacro( << "XSpace Allocated" );
otbMsgDebugMacro( << "XSpace Allocated" );
if(svm_check_probability_model(model)==0)
{
throw itk::ExceptionObject(__FILE__, __LINE__,
......@@ -212,10 +212,10 @@ SVMClassifier< TSample, TLabel >
}
int svm_type=svm_get_svm_type(model);
otbMsgDevMacro( << "SVM Type = " << svm_type );
otbMsgDebugMacro( << "SVM Type = " << svm_type );
int nr_class=svm_get_nr_class(model);
otbMsgDevMacro( << "SVM nr_class = " << nr_class );
otbMsgDebugMacro( << "SVM nr_class = " << nr_class );
int *labels=(int *) malloc(nr_class*sizeof(int));
double *prob_estimates=NULL;
......@@ -238,7 +238,7 @@ SVMClassifier< TSample, TLabel >
}
// while(1)
otbMsgDevMacro( << "Starting iterations " );
otbMsgDebugMacro( << "Starting iterations " );
while (iter != end && iterO != endO)
{
......@@ -273,28 +273,28 @@ SVMClassifier< TSample, TLabel >
measurements = iter.GetMeasurementVector() ;
otbMsgDevMacro( << "Loop on components " << svm_type );
// otbMsgDebugMacro( << "Loop on components " << svm_type );
for(i=0; i<numberOfComponentsPerSample; i++)
{
otbMsgDevMacro( << i << " " << measurements[i] );
otbMsgDevMacro( << "Index "<< x[i].index );
otbMsgDevMacro( << "Value "<< x[i].value );
// otbMsgDebugMacro( << i << " " << measurements[i] );
// otbMsgDebugMacro( << "Index "<< x[i].index );
// otbMsgDebugMacro( << "Value "<< x[i].value );
x[i].index = i+1 ;
x[i].value = measurements[i];
otbMsgDevMacro( << "Index "<< x[i].index );
otbMsgDevMacro( << "Value "<< x[i].value );
otbMsgDevMacro( << "-------------------" );
// otbMsgDebugMacro( << "Index "<< x[i].index );
// otbMsgDebugMacro( << "Value "<< x[i].value );
// otbMsgDebugMacro( << "-------------------" );
}
otbMsgDevMacro( << "Starting prediction" );
// otbMsgDebugMacro( << "Starting prediction" );
if (predict_probability && (svm_type==C_SVC || svm_type==NU_SVC))
{
otbMsgDevMacro( << "With predict" );
// otbMsgDebugMacro( << "With predict" );
v = svm_predict_probability(model,x,prob_estimates);
otbMsgDevMacro( << "Value : " << v );
// otbMsgDebugMacro( << "Value : " << v );
/*fprintf(output,"%g ",v);
for(j=0;j<nr_class;j++)
fprintf(output,"%g ",prob_estimates[j]);
......@@ -302,9 +302,9 @@ SVMClassifier< TSample, TLabel >
}
else
{
otbMsgDevMacro( << "Without predict" );
// otbMsgDebugMacro( << "Without predict" );
v = svm_predict(model,x);
otbMsgDevMacro( << "Value : " << v );
// otbMsgDebugMacro( << "Value : " << v );
//fprintf(output,"%g\n",v);
}
......@@ -315,24 +315,24 @@ SVMClassifier< TSample, TLabel >
// else
classLabel = static_cast<ClassLabelType>(v);
otbMsgDevMacro( << "Add instance " << classLabel );
otbMsgDevMacro( << "Add instance ident " << iterO.GetInstanceIdentifier() );
// otbMsgDebugMacro( << "Add instance " << classLabel );
// otbMsgDebugMacro( << "Add instance ident " << iterO.GetInstanceIdentifier() );
m_Output->AddInstance(classLabel, iterO.GetInstanceIdentifier()) ;
otbMsgDevMacro( << "After add instance " << iterO.GetClassLabel() );
// otbMsgDebugMacro( << "After add instance " << iterO.GetClassLabel() );
++iter;
++iterO;
}
otbMsgDevMacro( << "End of iterations " );
// otbMsgDebugMacro( << "End of iterations " );
if(predict_probability)
{
free(prob_estimates);
free(labels);
}
otbMsgDevMacro( << "End of iterations and free" );
// otbMsgDebugMacro( << "End of iterations and free" );
// free(x);
delete [] x;
......
......@@ -153,7 +153,7 @@ SVMImageModelEstimator<TInputImage, TTrainingImage>
unsigned int numberOfComponents = inIt.Get().Size();
otbMsgDevMacro( << " Before while " );
// otbMsgDevMacro( << " Before while " );
while(!inIt.IsAtEnd() && !trIt.IsAtEnd())
{
......
......@@ -36,7 +36,7 @@ SVMModel< TInputPixel, TLabel >::SVMModel()
m_Model = Malloc(svm_model,1);
m_Problem.l = 0;
otbMsgDevMacro( << "SVMModel::SVMModel - m_Problem.l = " << m_Problem.l );
otbMsgDebugMacro( << "SVMModel::SVMModel - m_Problem.l = " << m_Problem.l );
m_Problem.y = new double[1];
m_Problem.x = new struct svm_node*[1];
x_space = new struct svm_node[1];
......@@ -49,15 +49,15 @@ template <class TInputPixel, class TLabel >
SVMModel<TInputPixel, TLabel>::~SVMModel()
{
// FIXME: pbs. when deleting de problem ....
otbMsgDevMacro( << "SVMModel destructor" );
otbMsgDebugMacro( << "SVMModel destructor" );
/*
delete [] m_Problem.y;//free(m_Problem.y);
otbMsgDevMacro( << "SVMModel destructor - y done" );
otbMsgDebugMacro( << "SVMModel destructor - y done" );
delete [] m_Problem.x; //free(m_Problem.x);
otbMsgDevMacro( << "SVMModel destructor - x done" );
otbMsgDebugMacro( << "SVMModel destructor - x done" );
delete [] x_space;//
otbMsgDevMacro( << "SVMModel destructor - x_space done" );
otbMsgDebugMacro( << "SVMModel destructor - x_space done" );
//free(x_space);
*/
......@@ -71,24 +71,24 @@ void
SVMModel<TInputPixel, TLabel>
::AllocateProblem(int l, long int elements)
{
otbMsgDevMacro( << "SVMModel::AllocateProblem - enter" );
otbMsgDevMacro( << "SVMModel::AllocateProblem - l = " << l );
otbMsgDevMacro( << "SVMModel::AllocateProblem - elements = " << elements );
otbMsgDevMacro( << "SVMModel::AllocateProblem - m_Problem.l = " << m_Problem.l );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - enter" );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - l = " << l );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - elements = " << elements );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - m_Problem.l = " << m_Problem.l );
m_Problem.l = l;
otbMsgDevMacro( << "SVMModel::AllocateProblem - m_Problem.l = " << m_Problem.l );
otbMsgDevMacro( << "SVMModel::AllocateProblem - l done" );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - m_Problem.l = " << m_Problem.l );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - l done" );
delete [] m_Problem.y;
m_Problem.y = new double[l];//Malloc(double,l);
otbMsgDevMacro( << "SVMModel::AllocateProblem - y done" );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - y done" );
delete [] m_Problem.x;
m_Problem.x = new struct svm_node*[l];//Malloc(struct svm_node* ,l);
otbMsgDevMacro( << "SVMModel::AllocateProblem - x done" );
otbMsgDebugMacro( << "SVMModel::AllocateProblem - x done" );
delete [] x_space;
x_space = new struct svm_node[elements];
//free(x_space);
//x_space = Malloc(struct svm_node,elements);
//otbMsgDevMacro( << "SVMModel::AllocateProblem - x_space done" );
//otbMsgDebugMacro( << "SVMModel::AllocateProblem - x_space done" );
}
......@@ -98,11 +98,11 @@ void
SVMModel<TInputPixel, TLabel>
::SetModel(struct svm_model* aModel)
{
otbMsgDevMacro( << "SVMModel::SetModel - enter");
otbMsgDebugMacro( << "SVMModel::SetModel - enter");
//svm_destroy_model(m_Model);
otbMsgDevMacro( << "SVMModel::SetModel - destroyed" );
otbMsgDebugMacro( << "SVMModel::SetModel - destroyed" );
m_Model = aModel;
otbMsgDevMacro( << "SVMModel::SetModel - out" );
otbMsgDebugMacro( << "SVMModel::SetModel - out" );
}
......@@ -113,14 +113,14 @@ SVMModel<TInputPixel, TLabel>
{
return m_Problem;
// otbMsgDevMacro( << "SVMModel::GetProblem - enter" );
// otbMsgDebugMacro( << "SVMModel::GetProblem - enter" );
// aProblem.l = m_Problem.l;
// aProblem.y = m_Problem.y;
// aProblem.x = m_Problem.x;
// otbMsgDevMacro( << "SVMModel::GetProblem - x_space " << x_space );
// otbMsgDebugMacro( << "SVMModel::GetProblem - x_space " << x_space );
// // aNode = x_space;
// otbMsgDevMacro( << "SVMModel::GetProblem - out" );
// otbMsgDebugMacro( << "SVMModel::GetProblem - out" );
// return x_space;
}
......
......@@ -135,16 +135,16 @@ SVMModelEstimator<InputPixelType, LabelPixelType>
throw itk::ExceptionObject(__FILE__, __LINE__,error_msg,ITK_LOCATION);
}
otbMsgDevMacro( << "Starting training" );
otbMsgDebugMacro( << "Starting training" );
svm_model* tempModel = svm_train(&prob,&param);
otbMsgDevMacro( << "Training done" );
otbMsgDebugMacro( << "Training done" );
m_Model->SetModel(tempModel);
m_Model->SetNumberOfClasses( this->GetNumberOfClasses() );
otbMsgDevMacro( << "Training done" );
otbMsgDebugMacro( << "Training done" );
}// end train classifier
......@@ -170,10 +170,9 @@ SVMModelEstimator< InputPixelType, LabelPixelType >
prob = m_Model->GetProblem();
x_space = m_Model->GetXSpace();
otbMsgDevMacro( << "x_space " << x_space );
otbMsgDevMacro( << "prob = " << &prob );
otbMsgDevMacro( << "prob.l = " << prob.l );
otbMsgDebugMacro( << "x_space " << x_space );
otbMsgDebugMacro( << "prob = " << &prob );
otbMsgDebugMacro( << "prob.l = " << prob.l );
long int j=0;
long int i=0;
......@@ -185,19 +184,19 @@ SVMModelEstimator< InputPixelType, LabelPixelType >
typename TrainingLabelsType::iterator labelsEnd = m_Labels.end();
otbMsgDevMacro( << " Before while " );
// otbMsgDebugMacro( << " Before while " );
while(measIt!=measEnd && labelsIt!=labelsEnd)
{
double label = static_cast<double>(*labelsIt);
otbMsgDevMacro( << label );
otbMsgDevMacro( << prob.x[i] );
otbMsgDevMacro( << prob.y[i] );
otbMsgDevMacro( << &x_space[j] );
// otbMsgDebugMacro( << label );
// otbMsgDebugMacro( << prob.x[i] );
// otbMsgDebugMacro( << prob.y[i] );
// otbMsgDebugMacro( << &x_space[j] );
prob.x[i] = &x_space[j];
prob.y[i] = label;
otbMsgDevMacro( << "Label " << label << " " << i <<"/" << probl);
// otbMsgDebugMacro( << "Label " << label << " " << i <<"/" << probl);
typename MeasurementVectorType::iterator compIt = (*measIt).begin();
typename MeasurementVectorType::iterator compEnd = (*measIt).end();
......@@ -206,12 +205,12 @@ SVMModelEstimator< InputPixelType, LabelPixelType >
while(compIt!=compEnd)
{
otbMsgDevMacro( << "Index " << x_space[j].index );
otbMsgDevMacro( << "Value " << x_space[j].value );
// otbMsgDebugMacro( << "Index " << x_space[j].index );
// otbMsgDebugMacro( << "Value " << x_space[j].value );
x_space[j].index = k+1;
x_space[j].value = (*compIt);
otbMsgDevMacro( << x_space[j].index << ":" << x_space[j].value << " " << "j: " << j << " " );
// otbMsgDebugMacro( << x_space[j].index << ":" << x_space[j].value << " " << "j: " << j << " " );
++j;
++k;
++compIt;
......@@ -219,7 +218,7 @@ SVMModelEstimator< InputPixelType, LabelPixelType >
if(j>=1 && x_space[j-1].index > max_index)
max_index = x_space[j-1].index;
x_space[j++].index = -1;
// otbMsgDevMacro( " " );
// otbMsgDebugMacro( " " );
++i;
++measIt;
......@@ -228,7 +227,7 @@ SVMModelEstimator< InputPixelType, LabelPixelType >
}
otbMsgDevMacro( << "Processed " << i << " examples" );
otbMsgDebugMacro( << "Processed " << i << " examples" );
if(param.gamma == 0)
param.gamma = 1.0/max_index;
......
......@@ -107,11 +107,11 @@ SVMSampleListModelEstimator<TInputSampleList, TTrainingSampleList>
this->m_Labels.resize(0);
otbMsgDevMacro( << " Input nb points " << inputSampleListSize );
otbMsgDevMacro( << " Training nb points " << trainingSampleListSize );
otbMsgDebugMacro( << " Input nb points " << inputSampleListSize );
otbMsgDebugMacro( << " Training nb points " << trainingSampleListSize );
otbMsgDevMacro( << " Before while " );
// otbMsgDebugMacro( << " Before while " );
while(inIt!=inEnd && trIt!=trEnd)
{
......@@ -123,7 +123,7 @@ SVMSampleListModelEstimator<TInputSampleList, TTrainingSampleList>
this->m_Labels.push_back(label);
otbMsgDevMacro( << " Label " << label );
// otbMsgDebugMacro( << " Label " << label );
typename TInputSampleList::MeasurementVectorType value =
inIt.GetMeasurementVector();
......@@ -145,9 +145,9 @@ SVMSampleListModelEstimator<TInputSampleList, TTrainingSampleList>
++trIt;
}
otbMsgDevMacro( << " Before prepare data " );
// otbMsgDebugMacro( << " Before prepare data " );
this->PrepareData();
otbMsgDevMacro( << " After prepare data " );
// otbMsgDebugMacro( << " After prepare data " );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment