Clear Filters
Clear Filters

I ran an example code, but error occurred. (dlnetwork, Train Network Using Custom Training Loop)

1 view (last 30 days)
I ran an exmaple code of 'dlnetwork', in a part of "Train Network Using Custom Training Loop"
The code was excuted line by line, but there was a problem.
excuded code:
mbq = minibatchqueue(augimdsTrain,...
MiniBatchSize=miniBatchSize,...
MiniBatchFcn=@preprocessMiniBatch,...
MiniBatchFormat=["SSCB" ""]);
error occurred:
Error using minibatchqueue>iValidateMiniBatchFcn
Invalid value for 'MiniBatchFcn'. Unable to find function 'preprocessMiniBatch'.
Error in minibatchqueue>iParseInputs (line 695)
iValidateMiniBatchFcn(options.MiniBatchFcn, numVariables, options.NumOutputs);
Error in minibatchqueue (line 291)
options = iParseInputs(numVariables, varargin{:});
I don't know why this happened.
Is there any idea about this ?
Thank you in advance.

Accepted Answer

Angelo Yeo
Angelo Yeo on 6 Sep 2023
Edited: Angelo Yeo on 6 Sep 2023
안녕하세요.
아마도 아래의 문서에 포함된 예제 코드를 그대로 사용하신 것으로 보입니다.
예제에서는 preprocessMiniBatch 함수가 포함되어서 코드가 실행되었기 때문에 문제없이 mini-batching을 수행하는 과정이 문제없이 수행 되었습니다. 그러나, 현재 실행하시는 스크립트 및 매트랩 경로에는 preprocessMiniBatch 함수가 포함되어 있지 않은 것으로 보입니다. 따라서, 위 예제에서 사용하고 있는 preprocessMiniBatch 함수를 그대로 가져오시거나 현재 사용하시는 데이터의 형태에 맞게 함수를 수정하여 정의하여 주십시오.
  3 Comments
Angelo Yeo
Angelo Yeo on 6 Sep 2023
  1. 말씀해주신 예제에서도 마찬가지로 preprocessMiniBatch 함수가 따로 정의되어 있는 것을 알 수 있습니다. 현재 겪고 계시는 이슈는 정의된 preprocessMiniBatch 함수가 없기 때문에 발생하는 것이므로 예제에서 제공하는 preprocessMiniBatch 함수를 그대로 가져다 쓰시거나 현재 쓰시는 데이터에 맞게 변경하여 사용하셔야 합니다.
  2. 웹 문서나 R2023a의 Desktop MATLAB에서는 Try This Example이라는 버튼이 보이지 않습니다. Try This Example이라는 버튼을 확인하기 위한 방법을 조금 더 구체적으로 서술 부탁드립니다. "Open Live Script" 버튼을 눌러 나오는 스크립트를 실행했을 때에는 문제 없이 전체 코드를 실행할 수 있었습니다.
Yongwon Jang
Yongwon Jang on 8 Sep 2023
  1. 감사합니다. 말씀하신 것 처럼, 예제에 제공되는 supporting functions 모두를 function_name.m 파일로 저장하고 실행해보니 동작하는 것을 확인하였습니다. 어떻게 활용해야 하는지 이제 이해가 되었습니다. 아직도 @function_name 의 활용이 이해가 한번에 되지 않아 어렵네요.
  2. 다음 링크를 클릭하면 저는 위에 붙여넣은 그림처럼 Try This Example 과 Copy Command 두개의 버튼이 보입니다. 오히려 저는 open live script라는 버튼이 보이지 않는데요? 이건 왜 차이가 나는지 알 수 없습니다. 왜 그런 것인가요? https://kr.mathworks.com/help/deeplearning/ref/dlnetwork.html?searchHighlight=dlnetwork&s_tid=srchtitle_support_results_1_dlnetwork#mw_354460b9-891f-42f4-9919-3c2aea3ca31e

Sign in to comment.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!