OpenCV  3.0.0-rc1
Open Source Computer Vision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages


class  cv::datasets::OR_imagenet
struct  cv::datasets::OR_imagenetObj
class  cv::datasets::OR_mnist
struct  cv::datasets::OR_mnistObj
class  cv::datasets::OR_sun
struct  cv::datasets::OR_sunObj

Detailed Description


Implements loading dataset: "ImageNet":


  1. From link above download dataset files: ILSVRC2010_images_train.tar\ILSVRC2010_images_test.tar\ILSVRC2010_images_val.tar & devkit: ILSVRC2010_devkit-1.0.tar.gz (Implemented loading of 2010 dataset as only this dataset has ground truth for test data, but structure for ILSVRC2014 is similar)
  2. Unpack them to: some_folder/train/, some_folder/test/, some_folder/val & some_folder/ILSVRC2010_validation_ground_truth.txt, some_folder/ILSVRC2010_test_ground_truth.txt.
  3. Create file with labels: some_folder/labels.txt, for example, using python script below (each file's row format: synset,labelID,description. For example: "n07751451,18,plum").
  4. Unpack all tar files in train.
  5. To load data run:
    ./opencv/build/bin/example_datasets_or_imagenet -p=/home/user/some_folder/

Python script to parse meta.mat:

1 import
2 meta_mat ="devkit-1.0/data/meta.mat")
4 labels_dic = dict((m[0][1][0], m[0][0][0][0]-1) for m in meta_mat['synsets']
5 label_names_dic = dict((m[0][1][0], m[0][2][0]) for m in meta_mat['synsets']
7 for label in labels_dic.keys():
8  print "{0},{1},{2}".format(label, labels_dic[label], label_names_dic[label])


Implements loading dataset:



  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_datasets_or_mnist -p=/home/user/path_to_unpacked_files/

SUN Database

Implements loading dataset:

"SUN Database, Scene Recognition Benchmark. SUN397":


  1. From link above download dataset file: SUN397.tar & file with splits:
  2. Unpack SUN397.tar into folder: SUN397/ & into folder: SUN397/Partitions/
  3. To load data run:
    ./opencv/build/bin/example_datasets_or_sun -p=/home/user/path_to_unpacked_files/SUN397/