Problem in creating image database file.

5 vues (au cours des 30 derniers jours)
Sam
Sam le 13 Mai 2016
Commenté : Walter Roberson le 13 Mai 2016
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?

Réponses (1)

Walter Roberson
Walter Roberson le 13 Mai 2016
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 commentaires
Sam
Sam le 13 Mai 2016
Modifié(e) : Walter Roberson le 13 Mai 2016
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 le 13 Mai 2016
Multiply by 39/250

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by