[opengm] 76/386: rename gt to gts and add another dataset constructor
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:35:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository opengm.
commit f1908d59318527a28c86342b16e3f0da19a9b5bb
Author: mschiegg <martin.schiegg at iwr.uni-heidelberg.de>
Date: Tue Dec 16 17:58:52 2014 +0100
rename gt to gts and add another dataset constructor
---
include/opengm/learning/dataset/dataset.hxx | 20 ++++++++++----------
include/opengm/learning/dataset/dataset_io.hxx | 6 +++---
include/opengm/learning/dataset/testdatasets.hxx | 14 +++++++-------
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/include/opengm/learning/dataset/dataset.hxx b/include/opengm/learning/dataset/dataset.hxx
index aa32fb4..88bdf21 100644
--- a/include/opengm/learning/dataset/dataset.hxx
+++ b/include/opengm/learning/dataset/dataset.hxx
@@ -26,12 +26,12 @@ namespace opengm {
bool unlockModel(const size_t i) { OPENGM_ASSERT(count_[i]>0); --count_[i]; }
const GM& getModel(const size_t i) const { return gms_[i]; }
const GMWITHLOSS& getModelWithLoss(const size_t i)const { return gmsWithLoss_[i]; }
- const std::vector<LabelType>& getGT(const size_t i) const { return gt_[i]; }
+ const std::vector<LabelType>& getGT(const size_t i) const { return gts_[i]; }
Weights& getWeights() { return weights_; }
size_t getNumberOfWeights() const { return weights_.numberOfWeights(); }
size_t getNumberOfModels() const { return gms_.size(); }
- Dataset();
+ Dataset(size_t numInstances=0);
//void loadAll(std::string path,std::string prefix);
friend class DatasetSerialization;
@@ -42,7 +42,7 @@ namespace opengm {
std::vector<bool> isCached_;
std::vector<GM> gms_;
std::vector<GMWITHLOSS> gmsWithLoss_;
- std::vector<std::vector<LabelType> > gt_;
+ std::vector<std::vector<LabelType> > gts_;
Weights weights_;
void buildModelWithLoss(size_t i);
@@ -51,12 +51,12 @@ namespace opengm {
template<class GM, class LOSS>
- Dataset<GM, LOSS>::Dataset()
- : count_(std::vector<size_t>(0)),
- isCached_(std::vector<bool>(0)),
- gms_(std::vector<GM>(0)),
- gmsWithLoss_(std::vector<GMWITHLOSS>(0)),
- gt_(std::vector<std::vector<LabelType> >(0)),
+ Dataset<GM, LOSS>::Dataset(size_t numInstances)
+ : count_(std::vector<size_t>(numInstances)),
+ isCached_(std::vector<bool>(numInstances)),
+ gms_(std::vector<GM>(numInstances)),
+ gmsWithLoss_(std::vector<GMWITHLOSS>(numInstances)),
+ gts_(std::vector<std::vector<LabelType> >(numInstances)),
weights_(Weights(0))
{
};
@@ -66,7 +66,7 @@ namespace opengm {
void Dataset<GM, LOSS>::buildModelWithLoss(size_t i){
gmsWithLoss_[i] = gms_[i];
LOSS loss;
- loss.addLoss(gmsWithLoss_[i], gt_[i].begin());
+ loss.addLoss(gmsWithLoss_[i], gts_[i].begin());
}
/*
diff --git a/include/opengm/learning/dataset/dataset_io.hxx b/include/opengm/learning/dataset/dataset_io.hxx
index a4154f1..e43ebbb 100644
--- a/include/opengm/learning/dataset/dataset_io.hxx
+++ b/include/opengm/learning/dataset/dataset_io.hxx
@@ -65,15 +65,15 @@ namespace opengm{
marray::hdf5::closeFile(file);
dataset.gms_.resize(numModel);
- dataset.gmsWithLoss_.resize(numModel);
- dataset.gt_.resize(numModel);
+ dataset.gmsWithLoss_.resize(numModel);
+ dataset.gts_.resize(numModel);
dataset.weights_ = opengm::learning::Weights<ValueType>(numWeights);
//Load Models and ground truth
for(size_t m=0; m<numModel; ++m){
std::stringstream ss;
ss << datasetpath <<"/"<<prefix<<"gm_" << m <<".h5";
hid_t file = marray::hdf5::openFile(ss.str());
- marray::hdf5::loadVec(file, "gt", dataset.gt_[m]);
+ marray::hdf5::loadVec(file, "gt", dataset.gts_[m]);
marray::hdf5::closeFile(file);
opengm::hdf5::load(dataset.gms_[m],ss.str(),"gm");
dataset.buildModelWithLoss(m);
diff --git a/include/opengm/learning/dataset/testdatasets.hxx b/include/opengm/learning/dataset/testdatasets.hxx
index cb08545..4a18393 100644
--- a/include/opengm/learning/dataset/testdatasets.hxx
+++ b/include/opengm/learning/dataset/testdatasets.hxx
@@ -49,10 +49,10 @@ namespace opengm {
this->count_.resize(numModels,0);
this->weights_ = Weights(1);
LabelType numberOfLabels = 2;
- this->gt_.resize(numModels,std::vector<LabelType>(64*64,0));
+ this->gts_.resize(numModels,std::vector<LabelType>(64*64,0));
for(size_t m=0;m<numModels;++m){
for(size_t i=32*64; i<64*64; ++i){
- this->gt_[m][i] = 1;
+ this->gts_[m][i] = 1;
}
}
this->gms_.resize(numModels);
@@ -66,7 +66,7 @@ namespace opengm {
// function
const size_t shape[] = {numberOfLabels};
ExplicitFunction<ValueType> f(shape, shape + 1);
- ValueType val = (double)(this->gt_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.5 - 0.75 ;
+ ValueType val = (double)(this->gts_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.5 - 0.75 ;
f(0) = std::fabs(val-0);
f(1) = std::fabs(val-1);
typename GM::FunctionIdentifier fid = this->gms_[m].addFunction(f);
@@ -106,10 +106,10 @@ namespace opengm {
this->count_.resize(numModels,0);
this->weights_ = Weights(3);
LabelType numberOfLabels = 2;
- this->gt_.resize(numModels,std::vector<size_t>(64*64,0));
+ this->gts_.resize(numModels,std::vector<size_t>(64*64,0));
for(size_t m=0;m<numModels;++m){
for(size_t i=32*64; i<64*64; ++i){
- this->gt_[m][i] = 1;
+ this->gts_[m][i] = 1;
}
}
this->gms_.resize(numModels);
@@ -124,10 +124,10 @@ namespace opengm {
const size_t numExperts = 2;
const std::vector<size_t> shape(1,numberOfLabels);
std::vector<marray::Marray<ValueType> > feat(numExperts,marray::Marray<ValueType>(shape.begin(), shape.end()));
- ValueType val0 = (double)(this->gt_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.0 - 0.5 ;
+ ValueType val0 = (double)(this->gts_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.0 - 0.5 ;
feat[0](0) = std::fabs(val0-0);
feat[0](1) = std::fabs(val0-1);
- ValueType val1 = (double)(this->gt_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 2.0 - 1.0 ;
+ ValueType val1 = (double)(this->gts_[m][y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 2.0 - 1.0 ;
feat[1](0) = std::fabs(val1-0);
feat[1](1) = std::fabs(val1-1);
std::vector<size_t> wID(2);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git
More information about the debian-science-commits
mailing list