フィルターのクリア

Can Video calssification using deeplearning run on GPU ?

1 回表示 (過去 30 日間)
Xie Shipley
Xie Shipley 2023 年 11 月 17 日
コメント済み: Xie Shipley 2023 年 11 月 18 日
If there are someone can tell me can this Video Classification example in MATLAB doc run on GPU ?
inputSize = [28 28 1];
filterSize = 5;
numFilters = 20;
numHiddenUnits = 200;
numClasses = 10;
layers = [ ...
sequenceInputLayer(inputSize,'Name','input')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(filterSize,numFilters,'Name','conv')
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'OutputMode','last','Name','lstm')
fullyConnectedLayer(numClasses, 'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];
I Got this error :
CUDNN_STAT​US_EXECUTI​ON_FAILED
You can click here to see more error detail

採用された回答

Drew
Drew 2023 年 11 月 17 日
Using the MATLAB AI Chat Playground https://www.mathworks.com/matlabcentral/playground/new (see announcement at https://blogs.mathworks.com/community/2023/11/07/the-matlab-ai-chat-playground-has-launched/), I asked your question, and the response was:
Yes, you can train and test this LSTM network on a GPU in MATLAB. To do so, you can use the "trainNetwork" function with the "ExecutionEnvironment" option set to "gpu". Here's an example:
% Define the LSTM network
inputSize = [28 28 1];
filterSize = 5;
numFilters = 20;
numHiddenUnits = 200;
numClasses = 10;
layers = [ ...
sequenceInputLayer(inputSize,'Name','input')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(filterSize,numFilters,'Name','conv')
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'OutputMode','last','Name','lstm')
fullyConnectedLayer(numClasses, 'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];
% Specify the training options
options = trainingOptions('adam', ...
'MaxEpochs', 10, ...
'MiniBatchSize', 128, ...
'Shuffle', 'every-epoch', ...
'Verbose', false, ...
'Plots', 'training-progress', ...
'ExecutionEnvironment', 'gpu');
% Train the network
net = trainNetwork(XTrain,YTrain,layers,options);
% Test the network
YPred = classify(net,XTest);
accuracy = sum(YPred == YTest)/numel(YTest);
In this example, the "ExecutionEnvironment" option is set to "gpu" in the "trainingOptions" function. This will automatically use the GPU for training and testing the network, if one is available.
How can I check if my GPU is compatible with MATLAB?
Can I use multiple GPUs to train my network in MATLAB?
Is it possible to switch between CPU and GPU during training in MATLAB?
Here is the image view of the AI response:
If this answer helps you, please accept the answer, and I recommend to try the MATLAB AI Chat Playground https://www.mathworks.com/matlabcentral/playground/new for your MATLAB questions.
  1 件のコメント
Xie Shipley
Xie Shipley 2023 年 11 月 18 日
Do you have some information about XTrain and YTrain,? I want to check returned data format of my custom data store(mine is 791x2 table, two columns are predictors and responses, predictors is 700 cell contain 64x64x1x8000 image sequence , 8000 is the number of time steps response is 700 cell contain labels 1x8000)

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by