Problem in creating image database file.

3 ビュー (過去 30 日間)
Sam
Sam 2016 年 5 月 13 日
コメント済み: Walter Roberson 2016 年 5 月 13 日
Hi,
I am trying to code face key points detector using Matlab using NN toolbox. Training text file is of form (string path of face image followed by 4 integers-bounding box):
foldername\filename_0001.jpg 84 92 161 169
5000 rows like this.
How do I create mat file of this cropped face images and pass on as input to network?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 5 月 13 日
You would imread() each, imcrop(), reshape as a vector, add it to a column to a matrix you are building up. The completed matrix would be passed as the inputs for the neural network.
  2 件のコメント
Sam
Sam 2016 年 5 月 13 日
編集済み: Walter Roberson 2016 年 5 月 13 日
thanks for the reply, I need little more help now.
problem is after cropping i need to resize it to 39x39.
but my target (x,y)face points are give in original image dimensions(250x250).
how to rescale it to proper values after cropping and resizing for NN target i/p for training?
here is my code,
clear all;close all;
load('jpgfiletrain_short.mat');% loading cell imdata{} that contains 4 images
fileID = fopen('trainImageList_short.txt');
% 4 %u's are square bound box (x,y) pair that vary in size, 10 %f's are 5 (x,y) pair of 2 eye
% centers, 1 nose tip and 2 mouth corners...
C = textscan(fileID,'%s %u %u %u %u %f %f %f %f %f %f %f %f %f %f');
fclose(fileID);
% celldisp(C)
for k=1:4
cropdata{k}= imcrop(rgb2gray(imdata{k}),[C{2}(k) C{4}(k) C{3}(k)-C{2}(k) C{5}(k)-C{4}(k)]);
rszdata{k} = imresize(cropdata{k}, [39 39]);
target(:,k)=[C{6}(k) C{7}(k) C{8}(k) C{9}(k) C{10}(k) C{11}(k) C{12}(k) C{13}(k) C{14}(k) C{15}(k)];
end
Walter Roberson
Walter Roberson 2016 年 5 月 13 日
Multiply by 39/250

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by