How can i reshape a dataset maintaining the correct order?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, i need some help. I got a dataset composed by 701 images. They are RGB and i reduced them in 20x20. I created a 4-d array 20x20x3x701. Now the problem is that i need to insert this matrix in an lsh algorithm, but it requires a 2 dimensions matrix. So i tried to reshape and obtained a 1200x701, but the problem is that reshape can't maintain the order of the original matrix and the images are wrong, and the lsh algorithm execute in the wrong way. What can i do? The code is the following:
path='C:\Users\franc\Desktop\stage\californiaND\prova\*.jpg';
path2='C:\Users\franc\Desktop\stage\californiaND\prova\';
d=dir(path);
a=[];
for m=1:length(d)
a=cat(4,a,imread(strcat(path2,d(m).name)));
end
r=reshape(a,[],701);
r=double(r);
L = lshConstruct( r, 10,4);
2 comentarios
Respuestas (1)
Walter Roberson
el 20 de Ag. de 2017
If it is the above-linked vLSH code that you are using, then the reshape() you are doing is correct. The documentation for lshConstruct() says
% X: [D x N] matrix containing N columns of D-dimensional data
which in your case would be 1200 dimensional data, 701 different samples, which would be appropriate. The exact order of that each image got reshaped into would not matter, as long as it is a consistent order, as the routine is going to treat each of the 1200 points (per sample) as independent of the other points in the same sample.
Ver también
Categorías
Más información sobre Deep Learning Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!