activation() error for video classification.

3 vues (au cours des 30 derniers jours)
Ramesh M
Ramesh M le 21 Mar 2021
Check for incorrect argument data type or missing argument in call to function 'activations'.
Error in LSTMClass (line 38)
sequences{i,1} = activations(netCNN,'somfile.avi',layerName,'OutputAs','rows');

Réponses (1)

Harshavardhan
Harshavardhan le 29 Mai 2025
The error occurs because the “activations” function expects image data, such as 4-D arrays or an image datastore. To fix the error, the video frames need to be read and pre-processed first.
% Read video frames
v = VideoReader(somefile.avi);
frames = {};
while hasFrame(v)
img = readFrame(v);
frames{end+1} = img;
end
% Convert frames to 4D array
inputImages = cat(4, frames{:}); % [height, width, channels, numFrames]
% Extract features for all frames
features = activations(netCNN, inputImages, layerName, 'OutputAs', 'rows');
For more information on “VideoReader” , “readFrame”, “cat” and “activations”, refer to their respective links below.
Hope this helps.

Catégories

En savoir plus sur Install Products dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by