convert mat file to image
6 views (last 30 days)
Show older comments
Hello! I have a mat file attached. I have to perform classification problem later on using FFT+ Alexnet+transfer learning. So for the input in alexnet I want my data to be 2D from 1D as an image so I can implement further. What shall I do?
0 Comments
Accepted Answer
Image Analyst
on 12 Dec 2022
s = load('100.mat')
There are a lot of variables in there. Which should turn into an image, and how?
13 Comments
Walter Roberson
on 15 Dec 2022
What are the possibilities? Which possibilities have advantages or disadvantages?
- constant 0; constant 255; constant 127 or 128
- copy red channel; copy green channel
- some linear combination of red and green channel
None of the above add new information.
If you were training, then some of the possibilities would run the risk that the training would waste time chasing apparent information that was not really there.
But you are not training: you are using a pre-trained AlexNet for classification purposes. So then question then becomes which of those possibilities lead to the best predictions from that pre-trained network.
I think you will have a very difficult time getting anything useful out of the pre-trained alexnet for your purposes. I imagine, though, that your project assignment is to try it anyhow and see what you can do anyhow, and then analyze the failures, to demonstrate that you understand how the network is intended to work and talk about why it did not work for you.
Image Analyst
on 15 Dec 2022
(Expand to see Walter's comment above.)
If you're retraining Alexnet (transfer learning by replacing some layers), then all you have is info for two color channels. You can put them into whatever color channel you want but that still leaves one color channel that you have to create. I created it as just all zeros. I could be wrong but I think that with all zeros it might learn more quickly to ignore that channel completely. And that's what we need. We need all the weights for pixels in the 3rd channel to be zero since there is no additional information in that channel. The network should learn, during the retraining, to ignore that channel.
More Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!