How does MATLAB's "trainnet" function handle network state during training?

조회 수: 6 (최근 30일)
Diana
Diana 2025년 2월 17일
댓글: Diana 2025년 3월 3일
I am trying to understand the inner workings of MATLAB's "trainnet" function. Specifically, I need the following information:
Does "trainnet" operate on a copy of the network provided via the training options and only return the final trained network at the end of the training process?
Or is there a way to access and save the current state of the network during training (for example, after each epoch or according to custom output function)?
Any insights, explanations, or documentation references that clarify how MATLAB manages the network state during training would be greatly appreciated.
Thanks in advance!

답변 (1개)

Abhipsa
Abhipsa 2025년 2월 19일
Hi @Diana,
I have used this MATLAB documentation example (https://www.mathworks.com/help/deeplearning/ug/train-network-on-image-and-feature-data.html ) to verify if the original network and trained network obtained using “trainnet” of Deep Learning Toolbox are actually the same. It appears that the original network was not modified, suggesting it must be a copy.
I am attaching the output screenshot of my experimentation below.
To save and access the current state of the network during training you can use the “CheckpointPath” name-value pair in “trainingOptions”. This can be specified in the "options" input argument in "trainnet". You can refer to the below MATLAB links for more details:
I hope this helps you.
  댓글 수: 1
Diana
Diana 2025년 3월 3일
Thanks for your answer. My experience has also shown that MATLAB works with a copy of the network.
My choice was to specify ObjectiveMetricName and OutputNetwork under options. For example:
objective_metric = "recall";
output_network = "best-validation";
options = trainingOptions("adam", ...
ObjectiveMetricName=objective_metric, ...
OutputNetwork=output_network, ...
... );

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by