Deep Learning Toolbox - How to get Video Inputs in the Network, and use Videos in training?

3 ビュー (過去 30 日間)
Lars
Lars 2022 年 8 月 29 日
回答済み: Shreeya 2024 年 8 月 21 日
Hello, I am a new user to the Deep Learning Toolbox.
I am looking through the software and I have only seen the ability to make a network with a image input, and in the training area, it hasn't let me use videos for training. Any help would be appreciated.
  1 件のコメント
Lars
Lars 2022 年 8 月 29 日
If there is no way to do this in the Deep Learning Toolbox, where should I look next?

サインインしてコメントする。

回答 (1 件)

Shreeya
Shreeya 2024 年 8 月 21 日
Hi
To use video data for training a model using in the Deep Learning Toolbox, the `VideoReader` function in MATLAB to read video files frame by frame can be used. You can refer to the documentation linked below for understanding the implementation:
Below is a sample code to read the video files and use them as training data
v = VideoReader(videoFile);
frames = [];
while hasFrame(v)
%Preprocess and store the data as per the requirements
end
% Sample network architecture
layers = [
imageInputLayer([224 224 3])
convolution2dLayer(3, 8, 'Padding', 'same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(2)
softmaxLayer
classificationLayer];
%Train the Network
options = trainingOptions('sgdm', ...
'MaxEpochs', 10, ...
'InitialLearnRate', 0.01, ...
'Verbose', false, ...
'Plots', 'training-progress');
trainNetwork(frames, labels, layers, options);
Let me know if this helps!

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by