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 CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by