標籤:
Chars74K資料集是一個經典的字元識別資料集,主要包括了英文字元與坎那達語(Kannada)字元。資料集一共有74K幅映像,所以叫Chars74K。
英文資料集依據映像採集方式分為三個類別:
1. 自然環境下採集的字元映像資料集;
2. 手寫字元映像資料集;
3. 電腦不同字型合成的字元映像資料集。
這裡只介紹英文手寫字元資料集。該資料集包含了52個字元類別(A-Z,a-z)和10個數字類別(0-9)一共62個類別,3410副映像,由55個志願者手寫完成。
該資料集在EnglishHnd.tgz這個檔案中(English Hand writing),映像主要在Img這個檔案夾下,按照Samples001-Samples062的命名方式儲存在62個子檔案夾下,每個子檔案夾有55張映像,都為PNG格式,解析度為1200*900,三通道RGB映像。
一些映像:
資料集作者提供了matlab的讀入方式,在Lists.tgz檔案裡的English/Hnd檔案夾下有個lists_var_size.MAT檔案來進行資料讀入,但該檔案只是建立了一個結構體(struct),提供了相關資訊,映像的實際資料還是要自己寫代碼讀入。
該結構體載入進來後如下:
資料集作者已經將訓練資料與測試資料分成了30個不同的子集,就是以上的TRNind和TSTind,這裡面儲存的是映像的索引(Index),但這裡要注意的是有些訓練資料子集不是930個,後面有些資料是0。
以下的matlab代碼在作者提供的mat檔案基礎上,將一個子集的訓練資料、測試資料以及標籤(實際分類)等資訊讀入,映像資料讀入為cell數組,標籤資料讀入為uint16數組(需要注意的是標籤1代表實際的數字0,標籤2代表實際的數字1,依此類推)。
%% read images from chars74k English Hnd dataset.clc, clear;% list is a struct, which contains: % ALLlabels: [3410*1 uint16]% ALLnames: [3410*24 char]% classlabels: [62*1 double]% classnames: [62*13 char]% NUMclasses: 62% TSTind: [1674*30 uint16]% VALind: []% TXNind: [930*30 uint16]% TRNind: [930*30 uint16]load(‘lists_var_size.mat‘);%% extract training and test datasets%{There are 30 patches in the dataset(training & test)we will select the Nth training and test dataset.%}N = 14;% separats the training & test indexes in datasettraining_index = list.TRNind(:,N);test_index = list.TSTind(:,N);% some training patches may have some elements equal to 0% which we must ignore them.locate_zero = find(training_index == 0);training_index(locate_zero) = [];% the class labels for training settraining_labels = list.ALLlabels(training_index);% the ground truth labels for test settest_true_labels = list.ALLlabels(test_index);%% read image datafor ii = 1:length(training_index) img = imread([‘../../../English/Hnd/‘,... list.ALLnames(training_index(ii), :), ‘.png‘]); training_imgs{ii} = img;% if we want to see the image% image(img);% pause();endfor ii = 1:length(test_index) img = imread([‘../../../English/Hnd/‘,... list.ALLnames(test_index(ii), :), ‘.png‘]); test_imgs{ii} = img;% if we want to see the image% image(img);% pause();end
Python,OpenCV版本等待更新,或有人願意一起做可以互相交流。
有任何錯誤或不恰當的地方,歡迎指正。
參考連結:
http://www.ee.surrey.ac.uk/CVSSP/demos/chars74k/
參考文獻:
Teófilo Emídio de Campos, Bodla Rakesh Babu, Manik Varma. Character Recognition in Natural Images.[C]// Visapp 2009 - Proceedings of the Fourth International Conference on Computer Vision Theory and Applications, Lisboa, Portugal, February. 2009:273-280.
註:本文原發於七月線上論壇,是電腦視覺公開課的一次作業。
手寫字元識別資源匯總-Chars74K資料集簡介及手寫字元子資料集相關讀取方法
Chars74K資料集簡介及手寫字元子資料集相關讀取方法