Hi @Eline,
Addressing your query regarding, “I wanted to extract the feature vector of training and testing data from a dlnetwork by using the activations and forward functions, matlab show me this error with any format of training and testing data, Incorrect number or types of inputs or outputs for function activations or forward function.”
After analyzing the error message, it seems that forward and activations functions require specific input types. Here’s how you can resolve this issue. Convert your training and testing data to dlarray format if they are not already. For example:
dltrainData = dlarray(trainData, 'CB'); % 'C' for channels, 'B' for batch
Use the correct layer name when calling the functions. Make sure that the layer name you are using (in this case, net.Layers(181).Name) is valid and corresponds to an actual layer in your network. Here is example code snippet to illustrate it.
% Forward pass to get feature vector featureSet = forward(net, dltrainData, net.Layers(181).Name, 'OutputAs', 'columns');
% Using activations to extract features featureSetActivations = activations(net, dltrainData, net.Layers(181).Name);
Let me know if these steps helped resolve your problem.
Going back to “is there another running instruction with another format of training and testing data”
Try the solution mentioned above, if the issue still persist, then I will approach to find a solution regarding another running instruction.