OpenCV  4.6.0
Open Source Computer Vision
Classes

Classes

class  cv::datasets::OR_imagenet
 
struct  cv::datasets::OR_imagenetObj
 
class  cv::datasets::OR_mnist
 
struct  cv::datasets::OR_mnistObj
 
class  cv::datasets::OR_pascal
 
struct  cv::datasets::OR_pascalObj
 
class  cv::datasets::OR_sun
 
struct  cv::datasets::OR_sunObj
 
struct  cv::datasets::PascalObj
 
struct  cv::datasets::PascalPart
 

Detailed Description

ImageNet

Implements loading dataset: "ImageNet": http://www.image-net.org/

Usage:

  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:

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

MNIST

Implements loading dataset:

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

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

SUN Database

Implements loading dataset:

"SUN Database, Scene Recognition Benchmark. SUN397": http://vision.cs.princeton.edu/projects/2010/SUN/

Usage:

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