- Load the pre-trained CNN using MATLAB's alexnet (https://www.mathworks.com/help/deeplearning/ref/alexnet.html) or vgg16 (https://www.mathworks.com/help/deeplearning/ref/vgg16.html) functions, which will give you access to the CNN's layers and weights.
- Extract the activations of the CNN's final layer for your training data. These activations represent the "features" learned by the CNN that are most relevant to your problem.
- Use the extracted activations as input to your BPNN, along with any additional input features that may be relevant to your problem.
- Train the BPNN using the extracted activations as input and the desired outputs as targets.
I want to add CNN layer into a BPNN-PSO model, how can I do it?
조회 수: 27 (최근 30일)
이전 댓글 표시
This code is writeen from scrach with a classical three layer BPNN (input-hideen-output)
I want to add a CNN layer between the hidden layer and output layer. And the whole code should can be optimized by the SPO or other optimizer. could anyone show me some hints? or how to rewrite this code?
Here is the original code in github
https://github.com/meton-robean/SPO_BPNN_PID/
댓글 수: 0
답변 (1개)
Jasvin
2023년 3월 9일
It is not possible to directly add a Convolutional Neural Network (CNN) layer to a Backpropagation Neural Network (BPNN) in MATLAB, as the two types of networks have different architectures and training algorithms.
However, you can use a technique called transfer learning to adapt a pre-trained CNN for use in a BPNN. Transfer learning involves taking a CNN that has already been trained on a large dataset, and using the features learned by the CNN to train a new network on a smaller, related dataset.
Here's a high-level overview of the process:
Note that this is just a general outline of the process, and the specific details will depend on the specific problem you are trying to solve. Additionally, there are many variations and optimizations to transfer learning that you may want to consider, such as fine-tuning the pre-trained CNN on your specific dataset, or using multiple pre-trained CNNs to extract features at different levels of abstraction.
MATLAB provides several functions that can help with transfer learning, including activations (https://www.mathworks.com/help/deeplearning/ref/seriesnetwork.activations.html), classify (https://www.mathworks.com/help/stats/classify.html) and trainNetwork (https://www.mathworks.com/help/deeplearning/ref/trainnetwork.html).
댓글 수: 2
Jasvin
2023년 3월 13일
If you want to use CNN layers, then you can fully convert to a CNN based network as well and you can use the following FileExchange submission as a starting point,
Also if you found my answer to be helpful then you can mark it as the accepted answer.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!