Is it possible to reshape a vector into 3D matrix

조회 수: 13 (최근 30일)
Mammo Image
Mammo Image 2017년 11월 17일
편집: Mammo Image 2017년 11월 17일
I have a conv layer output which is 13x13x256. I have gotten the output feature of this layer using activations function in matlab as:
Feature = activations (net, trainingset, 15);
The feature is a vector equal to 43264. I need to re-enter this vector to the next layer which has an input size 13x13x256.
So how could I do that, should I reshape the feature vector to 13x13x256 matrix? how I do that?
Help me and thank you

답변 (1개)

Stephen23
Stephen23 2017년 11월 17일
편집: Stephen23 2017년 11월 17일
Use reshape:
>> V = rand(1,43264);
>> A = reshape(V,13,13,256);
  댓글 수: 3
Stephen23
Stephen23 2017년 11월 17일
편집: Stephen23 2017년 11월 17일
@Mammo Image: Whatever the number of elements the input array has, the reshaped array must contain exactly the same number of elements. So if you provide this:
V = rand(1,43264);
W = [V,V];
then you can do any of these:
A = reshape(W,2*13,13,256);
A = reshape(W,13,2*13,256);
A = reshape(W,13,13,2*256);
and no doubt many other sizes as well. Which one you want depends on your algorithm, which you have explained absolutely nothing about.
Mammo Image
Mammo Image 2017년 11월 17일
편집: Mammo Image 2017년 11월 17일
Thank you again, I have mentioned that I am using conv layer in deep learning (alexnet) and got the feature from the conv layer with dimension 43264, the thing is I want to feed these feature into another layer which it's input size should be 13x13x256.
for that reason, I am wondering if I did some change in the size of these features (for example concatenation with others), so then, is it possible to be as 13x13x256 to be suitable input for the second layer.
I think the second answer will give 26x13x256 which is not suitable input for the second conv layer.
Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by