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
3303575c
Commit
3303575c
authored
8 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add check on the cfield parameter, enhance documentation
parent
9c40708a
No related branches found
Branches containing commit
No related tags found
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/otbTrainVectorClassifier.cxx
+20
-6
20 additions, 6 deletions
...ations/AppClassification/app/otbTrainVectorClassifier.cxx
with
20 additions
and
6 deletions
Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
+
20
−
6
View file @
3303575c
...
...
@@ -106,8 +106,8 @@ private:
AddParameter
(
ParameterType_OutputFilename
,
"io.out"
,
"Output model"
);
SetParameterDescription
(
"io.out"
,
"Output file containing the model estimated (.txt format)."
);
AddParameter
(
ParameterType_ListView
,
"feat"
,
"
List of features to consider for classification
."
);
SetParameterDescription
(
"feat"
,
"List of f
eatures to consider for classification
."
);
AddParameter
(
ParameterType_ListView
,
"feat"
,
"
Field names for training features
."
);
SetParameterDescription
(
"feat"
,
"List of f
ield names in the input vector data to be used as features for training
."
);
AddParameter
(
ParameterType_String
,
"cfield"
,
"Field containing the class id for supervision"
);
SetParameterDescription
(
"cfield"
,
"Field containing the class id for supervision. "
...
...
@@ -115,7 +115,7 @@ private:
SetParameterString
(
"cfield"
,
"class"
);
AddParameter
(
ParameterType_Int
,
"layer"
,
"Layer Index"
);
SetParameterDescription
(
"layer"
,
"
Layer index to read
in the input vector file."
);
SetParameterDescription
(
"layer"
,
"
Index of the layer to use
in the input vector file."
);
MandatoryOff
(
"layer"
);
SetDefaultParameterInt
(
"layer"
,
0
);
...
...
@@ -128,7 +128,7 @@ private:
MandatoryOff
(
"valid.vd"
);
AddParameter
(
ParameterType_Int
,
"valid.layer"
,
"Layer Index"
);
SetParameterDescription
(
"valid.layer"
,
"
Layer index to read
in the validation vector file."
);
SetParameterDescription
(
"valid.layer"
,
"
Index of the layer to use
in the validation vector file."
);
MandatoryOff
(
"valid.layer"
);
SetDefaultParameterInt
(
"valid.layer"
,
0
);
...
...
@@ -140,7 +140,7 @@ private:
SetDocExampleParameterValue
(
"io.vd"
,
"vectorData.shp"
);
SetDocExampleParameterValue
(
"io.stats"
,
"meanVar.xml"
);
SetDocExampleParameterValue
(
"io.out"
,
"svmModel.svm"
);
SetDocExampleParameterValue
(
"feat"
,
"perimeter"
);
SetDocExampleParameterValue
(
"feat"
,
"perimeter
area width
"
);
SetDocExampleParameterValue
(
"cfield"
,
"predicted"
);
}
...
...
@@ -278,13 +278,27 @@ void DoExecute()
LabelListSampleType
::
Pointer
target
=
LabelListSampleType
::
New
();
input
->
SetMeasurementVectorSize
(
nbFeatures
);
int
cFieldIndex
=
0
;
int
cFieldIndex
=
-
1
;
std
::
vector
<
int
>
featureFieldIndex
=
GetSelectedItems
(
"feat"
);
if
(
feature
.
addr
())
{
cFieldIndex
=
feature
.
ogr
().
GetFieldIndex
(
GetParameterString
(
"cfield"
).
c_str
());
}
// Check that the class field exists
if
(
cFieldIndex
<
0
)
{
std
::
ostringstream
oss
;
std
::
vector
<
std
::
string
>
names
=
GetChoiceNames
(
"feat"
);
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
()
;
i
++
)
{
if
(
i
)
oss
<<
", "
;
oss
<<
names
[
i
];
}
otbAppLogFATAL
(
"The field name for class label ("
<<
GetParameterString
(
"cfield"
)
<<
") has not been found in the input vector file! Choices are "
<<
oss
.
str
());
}
while
(
goesOn
)
{
if
(
feature
.
ogr
().
IsFieldSet
(
cFieldIndex
))
...
...
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