Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
71838fd6
Commit
71838fd6
authored
5 years ago
by
Cédric Traizet
Browse files
Options
Downloads
Patches
Plain Diff
DOC: added documentation
parent
8ccec468
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Applications/AppClassification/app/otbTrainImagesRegression.cxx
+22
-3
22 additions, 3 deletions
...ations/AppClassification/app/otbTrainImagesRegression.cxx
with
22 additions
and
3 deletions
Modules/Applications/AppClassification/app/otbTrainImagesRegression.cxx
+
22
−
3
View file @
71838fd6
...
...
@@ -90,6 +90,8 @@ private:
}
protected
:
/** Holds sampling parameters specific to training or validation */
struct
SamplingParameters
{
std
::
vector
<
std
::
string
>
inputVectorList
;
...
...
@@ -97,6 +99,7 @@ protected:
std
::
string
filePrefix
=
""
;
};
/** Adds a class field to the input vectors, this is needed to perform sampling operations */
void
AddRegressionField
(
const
std
::
vector
<
std
::
string
>
&
inputFileNames
,
const
std
::
string
&
filePrefix
)
{
...
...
@@ -117,6 +120,7 @@ protected:
}
}
/** Prepare and execute polygonClassStatistics on each input vector data file */
void
ComputePolygonStatistics
(
const
std
::
string
&
filePrefix
)
{
auto
polygonClassAppli
=
GetInternalApplication
(
"polystat"
);
...
...
@@ -140,6 +144,7 @@ protected:
}
/** Compute the sampling rates using the computed statistics */
void
ComputeSamplingRate
(
const
std
::
string
&
filePrefix
,
unsigned
int
numberOfSamples
)
{
auto
samplingRateAppli
=
GetInternalApplication
(
"rates"
);
...
...
@@ -171,6 +176,7 @@ protected:
}
/** Configure and execute Sample Selection on each vector using the computed rates and statistic files. */
void
SelectSamples
(
const
std
::
string
&
filePrefix
)
{
auto
sampleSelection
=
GetInternalApplication
(
"select"
);
...
...
@@ -198,6 +204,9 @@ protected:
}
}
/** Configure and execute sampleExtraction. The application is called twice by input vector
* first values are extracted from the feature image and then the groundtruth is extracted
* from the predictor image.*/
void
ExtractSamples
(
const
std
::
string
&
filePrefix
)
{
auto
sampleExtraction
=
GetInternalApplication
(
"extraction"
);
...
...
@@ -212,13 +221,13 @@ protected:
sampleExtraction
->
UpdateParameters
();
sampleExtraction
->
SetParameterString
(
"field"
,
m_ClassFieldName
);
//First Extraction
//First Extraction
: Values from the feature image.
sampleExtraction
->
SetParameterInputImage
(
"in"
,
featureImageList
->
GetNthElement
(
i
));
sampleExtraction
->
SetParameterString
(
"outfield"
,
"prefix"
);
sampleExtraction
->
SetParameterString
(
"outfield.prefix.name"
,
m_FeaturePrefix
);
ExecuteInternal
(
"extraction"
);
//Second Extraction
//Second Extraction
: groundtruth from the predictor image.
sampleExtraction
->
SetParameterInputImage
(
"in"
,
predictorImageList
->
GetNthElement
(
i
));
sampleExtraction
->
SetParameterString
(
"outfield"
,
"list"
);
sampleExtraction
->
SetParameterStringList
(
"outfield.list.names"
,
{
m_PredictionFieldName
});
...
...
@@ -226,6 +235,8 @@ protected:
}
}
/** Configure and execute TrainVectorClassifier. Note that many parameters of TrainVectorClassifier
* are shared with the main application during initialization. */
void
TrainModel
()
{
auto
trainVectorRegression
=
GetInternalApplication
(
"training"
);
...
...
@@ -250,6 +261,7 @@ protected:
ExecuteInternal
(
"training"
);
}
/** Init input/output parameters */
void
InitIO
()
{
AddParameter
(
ParameterType_Group
,
"io"
,
"Input and output data"
);
...
...
@@ -272,6 +284,7 @@ protected:
MandatoryOff
(
"io.valid"
);
}
/** Init sampling parameters and applications */
void
InitSampling
()
{
AddApplication
(
"VectorDataSetField"
,
"setfield"
,
"Set additional vector field"
);
...
...
@@ -294,6 +307,7 @@ protected:
}
/** Init Learning applications and share learning parameters */
void
InitLearning
()
{
AddApplication
(
"TrainVectorRegression"
,
"training"
,
"Train vector regression"
);
...
...
@@ -313,6 +327,8 @@ private:
{
}
/** remove all file in the fileHandler std::map and clear the fileHandler std::map.
* For .shp file, this method also removes .shx, .dbf and .prj associated files.*/
bool
ClearFileHandler
()
{
bool
res
=
true
;
...
...
@@ -376,7 +392,6 @@ private:
PerformSampling
(
validParams
);
}
otbAppLogINFO
(
"Sampling Done."
);
TrainModel
();
...
...
@@ -388,12 +403,16 @@ private:
}
}
/** Field used for sampling operations. */
std
::
string
m_ClassFieldName
=
"regclass"
;
/** field containg the extracted regression groundtruth */
std
::
string
m_PredictionFieldName
=
"prediction"
;
/** field containing the extracted pixel values for regression */
std
::
string
m_FeaturePrefix
=
"value_"
;
/** Container containing the list of temporary files created during the execution*/
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
m_FileHandler
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment