pretrained deep learning network
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hi!
iwhen i use the pre trained deep kearning network and use it with droesy detection, can i train it more and more to get higher accuarcy or i can not train it ?
0 Kommentare
Antworten (1)
Aniket
am 23 Sep. 2024
You can further train the pre-trained deep learning network and use it with drowsiness detection to get higher accuracy if you have a training dataset for the same. This process is called Transfer learning and MATLAB has extensive resources to carry out this task.
First of all, create an image datastore (imds). An image datastore enables you to store large collections of image data, including data that does not fit in memory, and efficiently read batches of images during training of a neural network. Partition the data into training, validation, and testing data sets. Use 70% of the images for training, 15% for validation, and 15% for testing. The splitEachLabel function splits the image datastore into three new datastores.
[imdsTrain,imdsValidation,imdsTest] = splitEachLabel(imds,0.7,0.15,0.15,"randomized");
Then follow these steps to train the network:
1. Load Pretrained Network
Open the pretrained model using MATLAB Deep Network Designer app.
2. Edit Network for Transfer Learning
In Designer pane, unlock a convolution layer/ fully connected layer and update the properties as per your required model and adjust the learning parameters. Export to save the modified network as net_1.
3. Specify Training Options
Define the training options using the trainingOptions function:
options = trainingOptions("adam", ...
ValidationData=imdsValidation, ...
ValidationFrequency=5, ...
Plots="training-progress", ...
Metrics="accuracy", ...
Verbose=false);
4. Train Neural Network
Train the network using the trainnet function with cross-entropy loss:
net = trainnet(imdsTrain, net_1, "crossentropy", options);
5. Test Neural Network
Classify the test images using minibatchpredict and convert scores to labels with scores2label:
inputSize = net.Layers(1).InputSize(1:2);
augimdsTrain = augmentedImageDatastore(inputSize, imdsTest);
YTest = minibatchpredict(net, imdsTest);
YTest = scores2label(YTest, classNames);
For detailed steps, follow the procedure mentioned in the following documentation:
I hope this helps you to train your model with higher accuracy!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with Deep Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!