How to apply my image preprocessing for AlexNet?

5 vues (au cours des 30 derniers jours)
David Bielenberg
David Bielenberg le 8 Août 2019
Commenté : Debanjan Konar le 30 Mai 2020
Good Morning!
Due to a smaller university assignment I am working on a plate recognition programm using AlexNet. I am quite unexperienced with matlab. I have started by creating a quite simple function that crops different images to their license plate and returnes a binary image of the plate on a 277x277 image so it is preprocessed for AlexNet.
I have images stored in 3 folders for the 3 labels that are needed for my task. Right now I am still using generated plates, but the algorithm also works well enough for actual photos of cars
%load a well structured dataset into matlab. It contains folders for each label needed
% 1) Folder containing plates from city A
% 2) Folder containng plates from city B
% 3) Folder containing plates from random Cities
unzip('Generated.zip');
imds = imageDatastore('Generated', ...
'IncludeSubfolders',true, ...
'LabelSource','foldernames');
% apply my own preprocessing function to crop to license plates
% the datastore is transformed like I wanted it to.
% But it give me TransformedDatastore which won't work for the AlexNet
imdsCropped = transform(imds2,@(x) findPlate(x));
My problem is that the following code of AlexNet is not working with my Datastore, which after applying the 'transform' method is of type 'TransformedDatastore'
[imdsTrain,imdsValidation] = splitEachLabel(imdsCropped,0.7,'randomized');
Output: Undefined function 'splitEachLabel' for input arguments of type 'matlab.io.datastore.TransformedDatastore'.
Obviously, I am doing something wrong. Is there a way to cast the TransformedDatastore back to an imageDatastore, or is another function than 'transform' needed to apply the preprocessing of the images. I am also going to attach the full source code, if it helps finding the problem.
This is my first question. Let me know if I did something wrong. Happy about all kinds of help.
Have a nice day
  1 commentaire
Debanjan Konar
Debanjan Konar le 30 Mai 2020
which version of Mtalb you are using. I think it is lower version than 2018a.

Connectez-vous pour commenter.

Réponses (1)

karthikeyan chandrasekar
karthikeyan chandrasekar le 16 Août 2019
I am using alexnet trained model it seems you are doing training in wrong way, while training we should follow some constrains which allows us to train the existing network to our customised network.
Instead of using zip format of your data select the directory which contains this'Generated' folder and do your training (of your own data set).
plaese follow this link for training your network.
  1 commentaire
David Bielenberg
David Bielenberg le 25 Août 2019
Hello,
I do not understand. You say I should use a directory instead of a .zip file? How would that help with my problem? Also the link you shared basically shows the process with a zip file used for the imageDataStore.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows 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