Object RecognitionFramework for working with different datasets Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
Detailed Description
ImageNet
Implements loading dataset: "ImageNet": http://www.image-net.org/
Usage:
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)
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
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").
Unpack all tar files in train. 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 ])
MNISTImplements loading dataset:
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.
Unpack them.
To load data run: ./opencv /build /bin /example_datasets_or_mnist -p =/home /user /path_to_unpacked_files /
SUN DatabaseImplements loading dataset:
From link above download dataset file: SUN397.tar & file with splits: Partitions.zip
Unpack SUN397.tar into folder: SUN397/ & Partitions.zip into folder: SUN397/Partitions/
To load data run: ./opencv /build /bin /example_datasets_or_sun -p =/home /user /path_to_unpacked_files /SUN397 /