[pktools] 358/375: switched back from -bs and -be to -s and -e in svm and ann
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:54:30 UTC 2014
This is an automated email from the git hooks/post-receive script.
sebastic-guest pushed a commit to branch upstream-master
in repository pktools.
commit 5db6d79f4a48790a3d71792e13168692c184dfc4
Author: Pieter Kempeneers <kempenep at gmail.com>
Date: Wed Nov 19 11:17:38 2014 +0100
switched back from -bs and -be to -s and -e in svm and ann
---
ChangeLog | 10 ----------
src/algorithms/Filter2d.h | 2 +-
src/apps/pkann.cc | 4 ++--
src/apps/pkfilterdem.cc | 2 +-
src/apps/pkfsann.cc | 4 ++--
src/apps/pkfssvm.cc | 4 ++--
src/apps/pkinfo.cc | 2 +-
src/apps/pklas2img.cc | 2 +-
src/apps/pkoptsvm.cc | 4 ++--
src/apps/pksvm.cc | 19 +++++++++++++------
10 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0e626a5..5b9e617 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -319,16 +319,6 @@ version 2.5.4
support statistic rules (mean, stdev, median, etc.) for point features by taking into account buffer (default= 3 by 3 pixels). If option -polygon is set, output ogr features are polygons defining the buffer.
changed names for maximum and minumum rule to max and min respectively
new options -rand and -grid to support simple random sampling and systematic grid (do not provide sample vector dataset)
- - pksvm
- replaced options s|start and e|end with bs|bstart and be|bend
- - pkann
- replaced options s|start and e|end with bs|bstart and be|bend
- - pkfssvm
- replaced options s|start and e|end with bs|bstart and be|bend
- - pkfsann
- replaced options s|start and e|end with bs|bstart and be|bend
- - pkoptsvm
- replaced options s|start and e|end with bs|bstart and be|bend
- ImgWriteOgr
overwrite existing ogr datasets per default
diff --git a/src/algorithms/Filter2d.h b/src/algorithms/Filter2d.h
index d4e1917..221c1df 100644
--- a/src/algorithms/Filter2d.h
+++ b/src/algorithms/Filter2d.h
@@ -107,7 +107,7 @@ public:
template<class T> void dwtCut(Vector2d<T>& data, const std::string& wavelet_type, int family, double cut);
void majorVoting(const std::string& inputFilename, const std::string& outputFilename,int dim=0,const std::vector<int> &prior=std::vector<int>());
/* void homogeneousSpatial(const std::string& inputFilename, const std::string& outputFilename, int dim, bool disc=false, int noValue=0); */
- void doit(const ImgReaderGdal& input, ImgWriterGdal& output, const std::string& method, int dim, short down=2, bool disc=false);
+ void doit(const ImgReaderGdal& input, ImgWriterGdal& output, const std::string& method, int dim, short down=1, bool disc=false);
void doit(const ImgReaderGdal& input, ImgWriterGdal& output, const std::string& method, int dimX, int dimY, short down=1, bool disc=false);
void mrf(const ImgReaderGdal& input, ImgWriterGdal& output, int dimX, int dimY, double beta, bool eightConnectivity=true, short down=1, bool verbose=false);
void mrf(const ImgReaderGdal& input, ImgWriterGdal& output, int dimX, int dimY, Vector2d<double> beta, bool eightConnectivity=true, short down=1, bool verbose=false);
diff --git a/src/apps/pkann.cc b/src/apps/pkann.cc
index b173597..d20271b 100644
--- a/src/apps/pkann.cc
+++ b/src/apps/pkann.cc
@@ -46,8 +46,8 @@ int main(int argc, char *argv[])
Optionpk<bool> random_opt("random", "random", "in case of balance, randomize input data", true,2);
Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account (0: consider all classes)", 0);
Optionpk<short> band_opt("b", "band", "band index (starting from 0, either use band option or use start to end)");
- Optionpk<double> bstart_opt("bs", "bstart", "start band sequence number",0);
- Optionpk<double> bend_opt("be", "bend", "end band sequence number (set to 0 to include bands)", 0);
+ Optionpk<double> bstart_opt("s", "start", "start band sequence number",0);
+ Optionpk<double> bend_opt("e", "end", "end band sequence number (set to 0 to include bands)", 0);
Optionpk<double> offset_opt("\0", "offset", "offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]", 0.0);
Optionpk<double> scale_opt("\0", "scale", "scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)", 0.0);
Optionpk<unsigned short> aggreg_opt("a", "aggreg", "how to combine aggregated classifiers, see also rc option (1: sum rule, 2: max rule).",1);
diff --git a/src/apps/pkfilterdem.cc b/src/apps/pkfilterdem.cc
index a62c598..da040a5 100644
--- a/src/apps/pkfilterdem.cc
+++ b/src/apps/pkfilterdem.cc
@@ -1,5 +1,5 @@
/**********************************************************************
-pkfilterdem.cc: program to post filter raster images created with pklas2img
+pkfilterdem.cc: Filter digital elevation model raster datasets
Copyright (C) 2008-2014 Pieter Kempeneers
This file is part of pktools
diff --git a/src/apps/pkfsann.cc b/src/apps/pkfsann.cc
index d155158..08946e5 100644
--- a/src/apps/pkfsann.cc
+++ b/src/apps/pkfsann.cc
@@ -180,8 +180,8 @@ int main(int argc, char *argv[])
Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account", 0);
Optionpk<short> band_opt("b", "band", "band index (starting from 0, either use band option or use start to end)");
- Optionpk<double> bstart_opt("bs", "bstart", "start band sequence number",0);
- Optionpk<double> bend_opt("be", "bend", "end band sequence number (set to 0 to include all bands)", 0);
+ Optionpk<double> bstart_opt("s", "start", "start band sequence number",0);
+ Optionpk<double> bend_opt("e", "end", "end band sequence number (set to 0 to include all bands)", 0);
Optionpk<double> offset_opt("\0", "offset", "offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]", 0.0);
Optionpk<double> scale_opt("\0", "scale", "scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)", 0.0);
Optionpk<unsigned short> aggreg_opt("a", "aggreg", "how to combine aggregated classifiers, see also rc option (0: no aggregation, 1: sum rule, 2: max rule).",0);
diff --git a/src/apps/pkfssvm.cc b/src/apps/pkfssvm.cc
index 67c96d0..83caa76 100644
--- a/src/apps/pkfssvm.cc
+++ b/src/apps/pkfssvm.cc
@@ -206,8 +206,8 @@ int main(int argc, char *argv[])
Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account", 0);
Optionpk<short> band_opt("b", "band", "band index (starting from 0, either use band option or use start to end)");
- Optionpk<double> bstart_opt("bs", "bstart", "start band sequence number",0);
- Optionpk<double> bend_opt("be", "bend", "end band sequence number (set to 0 to include all bands)", 0);
+ Optionpk<double> bstart_opt("s", "start", "start band sequence number",0);
+ Optionpk<double> bend_opt("e", "end", "end band sequence number (set to 0 to include all bands)", 0);
Optionpk<double> offset_opt("\0", "offset", "offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]", 0.0);
Optionpk<double> scale_opt("\0", "scale", "scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)", 0.0);
Optionpk<string> selector_opt("sm", "sm", "feature selection method (sffs=sequential floating forward search,sfs=sequential forward search, sbs, sequential backward search ,bfs=brute force search)","sffs");
diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc
index 116456c..2978eed 100644
--- a/src/apps/pkinfo.cc
+++ b/src/apps/pkinfo.cc
@@ -1,5 +1,5 @@
/**********************************************************************
-pkinfo.cc: program to retrieve information from raster images
+pkinfo.cc: Report basic information from raster datasets (similar to gdalinfo)
Copyright (C) 2008-2014 Pieter Kempeneers
This file is part of pktools
diff --git a/src/apps/pklas2img.cc b/src/apps/pklas2img.cc
index 5cf97f8..ff6f542 100644
--- a/src/apps/pklas2img.cc
+++ b/src/apps/pklas2img.cc
@@ -1,5 +1,5 @@
/**********************************************************************
-pklas2img.cc: program to create (e.g., DEM) raster image from las files
+pklas2img.cc: Rasterize LAS/LAZ point clouds with filtering/compositing options
Copyright (C) 2008-2014 Pieter Kempeneers
This file is part of pktools
diff --git a/src/apps/pkoptsvm.cc b/src/apps/pkoptsvm.cc
index 0452469..2463237 100644
--- a/src/apps/pkoptsvm.cc
+++ b/src/apps/pkoptsvm.cc
@@ -267,8 +267,8 @@ int main(int argc, char *argv[])
Optionpk<bool> random_opt("random","random", "in case of balance, randomize input data", true);
Optionpk<int> minSize_opt("min", "min", "if number of training pixels is less then min, do not take this class into account", 0);
Optionpk<short> band_opt("b", "band", "band index (starting from 0, either use band option or use start to end)");
- Optionpk<double> bstart_opt("bs", "bstart", "start band sequence number",0);
- Optionpk<double> bend_opt("be", "bend", "bend band sequence number (set to 0 to include all bands)", 0);
+ Optionpk<double> bstart_opt("s", "start", "start band sequence number",0);
+ Optionpk<double> bend_opt("e", "end", "end band sequence number (set to 0 to include all bands)", 0);
Optionpk<double> offset_opt("\0", "offset", "offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]", 0.0);
Optionpk<double> scale_opt("\0", "scale", "scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)", 0.0);
Optionpk<float> gamma_opt("g", "gamma", "min max boundaries for gamma in kernel function (optional: initial value)",0);
diff --git a/src/apps/pksvm.cc b/src/apps/pksvm.cc
index e441f96..0745a52 100644
--- a/src/apps/pksvm.cc
+++ b/src/apps/pksvm.cc
@@ -56,8 +56,8 @@ int main(int argc, char *argv[])
Optionpk<bool> random_opt("random", "random", "Randomize training data for balancing and bagging", true, 2);
Optionpk<int> minSize_opt("min", "min", "If number of training pixels is less then min, do not take this class into account (0: consider all classes)", 0);
Optionpk<short> band_opt("b", "band", "Band index (starting from 0, either use band option or use start to end)");
- Optionpk<double> bstart_opt("bs", "bstart", "Start band sequence number",0);
- Optionpk<double> bend_opt("be", "bend", "End band sequence number (set to 0 to include all bands)", 0);
+ Optionpk<double> bstart_opt("s", "start", "Start band sequence number",0);
+ Optionpk<double> bend_opt("e", "end", "End band sequence number (set to 0 to include all bands)", 0);
Optionpk<double> offset_opt("\0", "offset", "Offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]", 0.0);
Optionpk<double> scale_opt("\0", "scale", "Scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)", 0.0);
Optionpk<double> priors_opt("prior", "prior", "Prior probabilities for each class (e.g., -p 0.3 -p 0.3 -p 0.2 ). Used for input only (ignored for cross validation)", 0.0);
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
// Optionpk<bool> weight_opt("wi", "wi", "Set the parameter C of class i to weight*C, for C_SVC",true);
Optionpk<unsigned short> comb_opt("comb", "comb", "How to combine bootstrap aggregation classifiers (0: sum rule, 1: product rule, 2: max rule). Also used to aggregate classes with rc option.",0);
Optionpk<unsigned short> bag_opt("bag", "bag", "Number of bootstrap aggregations", 1);
- Optionpk<int> bagSize_opt("bs", "bsize", "Percentage of features used from available training features for each bootstrap aggregation (one size for all classes, or a different size for each class respectively", 100);
+ Optionpk<int> bagSize_opt("bagsize", "bagsize", "Percentage of features used from available training features for each bootstrap aggregation (one size for all classes, or a different size for each class respectively", 100);
Optionpk<string> classBag_opt("cb", "classbag", "Output for each individual bootstrap aggregation");
Optionpk<string> mask_opt("m", "mask", "Use the first band of the specified file as a validity mask. Nodata values can be set with the option msknodata.");
Optionpk<short> msknodata_opt("msknodata", "msknodata", "Mask value(s) not to consider for classification (use negative values if only these values should be taken into account). Values will be taken over in classification image.", 0);
@@ -467,7 +467,8 @@ int main(int argc, char *argv[])
int index=0;
if(bagSize_opt[iclass]<100)
random_shuffle(trainingPixels[iclass].begin(),trainingPixels[iclass].end());
-
+ if(verbose_opt[0]>1)
+ std::cout << "nctraining (class " << iclass << "): " << nctraining << std::endl;
trainingFeatures[iclass].resize(nctraining);
for(int isample=0;isample<nctraining;++isample){
//scale pixel values according to scale and offset!!!
@@ -480,9 +481,13 @@ int main(int argc, char *argv[])
}
unsigned int nFeatures=trainingFeatures[0][0].size();
+ if(verbose_opt[0]>=1)
+ std::cout << "number of features: " << nFeatures << std::endl;
unsigned int ntraining=0;
for(short iclass=0;iclass<nclass;++iclass)
ntraining+=trainingFeatures[iclass].size();
+ if(verbose_opt[0]>=1)
+ std::cout << "training size over all classes: " << ntraining << std::endl;
prob[ibag].l=ntraining;
prob[ibag].y = Malloc(double,prob[ibag].l);
@@ -529,7 +534,11 @@ int main(int argc, char *argv[])
if(verbose_opt[0])
std::cout << "parameters ok, training" << std::endl;
svm[ibag]=svm_train(&prob[ibag],¶m[ibag]);
+ if(verbose_opt[0]>1)
+ std::cout << "SVM is now trained" << std::endl;
if(cv_opt[0]>1){
+ if(verbose_opt[0]>1)
+ std::cout << "Cross validating" << std::endl;
double *target = Malloc(double,prob[ibag].l);
svm_cross_validation(&prob[ibag],¶m[ibag],cv_opt[0],target);
assert(param[ibag].svm_type != EPSILON_SVR&¶m[ibag].svm_type != NU_SVR);//only for regression
@@ -544,8 +553,6 @@ int main(int argc, char *argv[])
}
free(target);
}
- if(verbose_opt[0]>1)
- std::cout << "SVM is now trained" << std::endl;
// *NOTE* Because svm_model contains pointers to svm_problem, you can
// not free the memory used by svm_problem if you are still using the
// svm_model produced by svm_train().
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git
More information about the Pkg-grass-devel
mailing list