Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions modules/datasetstools/doc/datasetstools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ datasetstools. Tools for working with different datasets.

The datasetstools module includes classes for working with different datasets.

First version of this module was implemented for **Fall2014 OpenCV Challenge**.

Action Recognition
------------------

Expand Down Expand Up @@ -50,13 +48,13 @@ FR_lfw

Implements loading dataset:

_`"Labeled Faces in the Wild-a"`: http://www.openu.ac.il/home/hassner/data/lfwa/
_`"Labeled Faces in the Wild"`: http://vis-www.cs.umass.edu/lfw/

.. note:: Usage

1. From link above download dataset file: lfwa.tar.gz.
1. From link above download any dataset file: lfw.tgz\lfwa.tar.gz\lfw-deepfunneled.tgz\lfw-funneled.tgz and file with 10 test splits: pairs.txt.

2. Unpack it.
2. Unpack dataset file and place pairs.txt in created folder.

3. To load data run: ./opencv/build/bin/example_datasetstools_fr_lfw -p=/home/user/path_to_unpacked_folder/lfw2/

Expand All @@ -75,9 +73,11 @@ _`"ChaLearn Looking at People"`: http://gesture.chalearn.org/

1. Follow instruction from site above, download files for dataset "Track 3: Gesture Recognition": Train1.zip-Train5.zip, Validation1.zip-Validation3.zip (Register on site: www.codalab.org and accept the terms and conditions of competition: https://www.codalab.org/competitions/991#learn_the_details There are three mirrors for downloading dataset files. When I downloaded data only mirror: "Universitat Oberta de Catalunya" works).

2. Unpack train archives Train1.zip-Train5.zip to one folder (currently loading validation files wasn't implemented)
2. Unpack train archives Train1.zip-Train5.zip to folder Train/, validation archives Validation1.zip-Validation3.zip to folder Validation/

3. To load data run: ./opencv/build/bin/example_datasetstools_gr_chalearn -p=/home/user/path_to_unpacked_folder/
3. Unpack all archives in Train/ & Validation/ in the folders with the same names, for example: Sample0001.zip to Sample0001/

4. To load data run: ./opencv/build/bin/example_datasetstools_gr_chalearn -p=/home/user/path_to_unpacked_folders/

GR_skig
=======
Expand Down Expand Up @@ -239,13 +239,29 @@ Currently implemented loading full list with urls. Planned to implement dataset

3. To load data run: ./opencv/build/bin/example_datasetstools_or_imagenet -p=/home/user/path_to_unpacked_file/

OR_mnist
===========
.. ocv:class:: OR_mnist

Implements loading dataset:

_`"MNIST"`: http://yann.lecun.com/exdb/mnist/

.. note:: Usage

1. From link above download dataset files: t10k-images-idx3-ubyte.gz, t10k-labels-idx1-ubyte.gz, train-images-idx3-ubyte.gz, train-labels-idx1-ubyte.gz.

2. Unpack them.

3. To load data run: ./opencv/build/bin/example_datasetstools_or_mnist -p=/home/user/path_to_unpacked_files/

OR_sun
======
.. ocv:class:: OR_sun

Implements loading dataset:

_`"SUN Database"`: http://sun.cs.princeton.edu/
_`"SUN Database"`: http://sundatabase.mit.edu/

Currently implemented loading "Scene Recognition Benchmark. SUN397". Planned to implement also "Object Detection Benchmark. SUN2012".

Expand Down
11 changes: 2 additions & 9 deletions modules/datasetstools/include/opencv2/datasetstools/ar_hmdb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,9 @@ struct AR_hmdbObj : public Object
class CV_EXPORTS AR_hmdb : public Dataset
{
public:
AR_hmdb() {}
AR_hmdb(const std::string &path, int number = 0);
virtual ~AR_hmdb() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path, int number = 0);

void loadAction(const std::string &fileName, std::vector<std::string> &train_, std::vector<std::string> &test_);
static Ptr<AR_hmdb> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,9 @@ struct AR_sportsObj : public Object
class CV_EXPORTS AR_sports : public Dataset
{
public:
AR_sports() {}
AR_sports(const std::string &path);
virtual ~AR_sports() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);

void loadDatasetPart(const std::string &fileName, std::vector< Ptr<Object> > &dataset_);
static Ptr<AR_sports> create();
};

}
Expand Down
17 changes: 14 additions & 3 deletions modules/datasetstools/include/opencv2/datasetstools/dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,21 @@ class CV_EXPORTS Dataset
Dataset() {}
virtual ~Dataset() {}

virtual void load(const std::string &path, int number = 0) = 0;
virtual void load(const std::string &path) = 0;

std::vector< Ptr<Object> > train;
std::vector< Ptr<Object> > test;
std::vector< Ptr<Object> >& getTrain(int splitNum = 0);
std::vector< Ptr<Object> >& getTest(int splitNum = 0);
std::vector< Ptr<Object> >& getValidation(int splitNum = 0);

int getNumSplits() const;

protected:
std::vector< std::vector< Ptr<Object> > > train;
std::vector< std::vector< Ptr<Object> > > test;
std::vector< std::vector< Ptr<Object> > > validation;

private:
std::vector< Ptr<Object> > empty;
};

}
Expand Down
13 changes: 4 additions & 9 deletions modules/datasetstools/include/opencv2/datasetstools/fr_lfw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,16 @@ namespace datasetstools

struct FR_lfwObj : public Object
{
std::string name;
std::vector<std::string> images;
std::string image1, image2;
bool same;
};

class CV_EXPORTS FR_lfw : public Dataset
{
public:
FR_lfw() {}
FR_lfw(const std::string &path);
virtual ~FR_lfw() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<FR_lfw> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,9 @@ struct GR_chalearnObj : public Object
class CV_EXPORTS GR_chalearn : public Dataset
{
public:
GR_chalearn() {}
GR_chalearn(const std::string &path);
virtual ~GR_chalearn() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<GR_chalearn> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,9 @@ struct GR_skigObj : public Object
class CV_EXPORTS GR_skig : public Dataset
{
public:
GR_skig() {}
GR_skig(const std::string &path);
virtual ~GR_skig() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<GR_skig> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,9 @@ struct HPE_parseObj : public Object
class CV_EXPORTS HPE_parse : public Dataset
{
public:
HPE_parse() {}
HPE_parse(const std::string &path);
virtual ~HPE_parse() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<HPE_parse> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,9 @@ struct IR_affineObj : public Object
class CV_EXPORTS IR_affine : public Dataset
{
public:
IR_affine() {}
IR_affine(const std::string &path);
virtual ~IR_affine() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<IR_affine> create();
};

}
Expand Down
16 changes: 8 additions & 8 deletions modules/datasetstools/include/opencv2/datasetstools/ir_robot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ namespace datasetstools
// 0.0000e+00 2.8285e+03 6.1618e+02
// 0.0000e+00 0.0000e+00 1.0000e+00

struct cameraPos
{
std::vector<std::string> images;
};

struct IR_robotObj : public Object
{
std::string name;
std::vector<std::string> images; // TODO: implement more complex structure
std::vector<cameraPos> pos;
};

class CV_EXPORTS IR_robot : public Dataset
{
public:
IR_robot() {}
IR_robot(const std::string &path);
virtual ~IR_robot() {}

virtual void load(const std::string &path, int number = 0);
virtual void load(const std::string &path) = 0;

private:
void loadDataset(const std::string &path);
static Ptr<IR_robot> create();
};

}
Expand Down
11 changes: 2 additions & 9 deletions modules/datasetstools/include/opencv2/datasetstools/is_bsds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,9 @@ struct IS_bsdsObj : public Object
class CV_EXPORTS IS_bsds : public Dataset
{
public:
IS_bsds() {}
IS_bsds(const std::string &path);
virtual ~IS_bsds() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);

void loadDatasetPart(const std::string &fileName, std::vector< Ptr<Object> > &dataset_);
static Ptr<IS_bsds> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,9 @@ struct IS_weizmannObj : public Object
class CV_EXPORTS IS_weizmann : public Dataset
{
public:
IS_weizmann() {}
IS_weizmann(const std::string &path);
virtual ~IS_weizmann() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<IS_weizmann> create();
};

}
Expand Down
24 changes: 14 additions & 10 deletions modules/datasetstools/include/opencv2/datasetstools/msm_epfl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,29 @@ namespace cv
namespace datasetstools
{

struct cameraParam
{
Matx33d mat1;
double mat2[3];
Matx33d mat3;
double mat4[3];
int imageWidth, imageHeight;
};

struct MSM_epflObj : public Object
{
std::string imageName;
std::vector<double> bounding, camera, p; // TODO: implement better structures
Matx23d bounding;
Matx34d p;
cameraParam camera;
};

class CV_EXPORTS MSM_epfl : public Dataset
{
public:
MSM_epfl() {}
MSM_epfl(const std::string &path);
virtual ~MSM_epfl() {}

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
virtual void load(const std::string &path) = 0;

void readFileDouble(const std::string &fileName, std::vector<double> &out);
static Ptr<MSM_epfl> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,17 @@ namespace datasetstools
struct MSM_middleburyObj : public Object
{
std::string imageName;
double k[3][3];
double r[3][3];
Matx33d k;
Matx33d r;
double t[3];
};

class CV_EXPORTS MSM_middlebury : public Dataset
{
public:
MSM_middlebury() {}
MSM_middlebury(const std::string &path);
virtual ~MSM_middlebury() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

private:
void loadDataset(const std::string &path);
static Ptr<MSM_middlebury> create();
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

#include <string>
#include <vector>
#include <set>

#include "opencv2/datasetstools/dataset.hpp"

Expand All @@ -65,16 +64,9 @@ struct OR_imagenetObj : public Object
class CV_EXPORTS OR_imagenet : public Dataset
{
public:
OR_imagenet() {}
OR_imagenet(const std::string &path);
virtual ~OR_imagenet() {}
virtual void load(const std::string &path) = 0;

virtual void load(const std::string &path, int number = 0);

std::set<std::string> wnids;

private:
void loadDataset(const std::string &path);
static Ptr<OR_imagenet> create();
};

}
Expand Down
Loading