Encountering 'Invalid Bias Array' Error During Inference with a Trained Classification Model in MATLAB.
1 次查看(过去 30 天)
显示 更早的评论
Hello MathWorks Community,
I am currently facing an issue with my deep learning model in MATLAB. After training a classification model successfully, I am encountering an error during the inference stage. The error message is as follows:
Error using DAGNetwork/predictBatch
Invalid bias array
Error in DAGNetwork/calculatePredict (line 16)
Y = predictBatch( ...
Error in DAGNetwork/predict (line 181)
Y = this.calculatePredict( ...
Error in SeriesNetwork/predict (line 302)
Y = this.UnderlyingDAGNetwork.predict(X, varargin{:});
I am using MATLAB R2022a for this project. Here are some details about my situation:
- Model Architecture: I have a customLayer which is self defined according to my project and the task. It contain 4 learnable weights without using a Bias. The model ends with a fully connected layer, softmax, and classification layer.
- Training Process: I have trained the model to classify binary sequences with a dataset of 60k sample, using a batchsize of 40, 10 epochs and rmsprop as optimizer with a learning rate 0.01.
- Data Format during Inference: The data is a sequence of size K+N, where the first sequence of size K is used for a specific task in the custom layer, and the K+1 to N size sequence is used as main data (the X input variable and the Z output).
Has anyone encountered a similar issue or can offer insights into what might be causing this 'Invalid bias array' error? Any suggestions on how to troubleshoot or fix this would be greatly appreciated.
Thank you in advance for your help!
0 个评论
回答(1 个)
Jinal
2023-12-19
Hi Ahcen
As per my understanding, you are encountering ‘Invalid Bias array’ error during the inference stage, for your deep learning model in MATLAB R2022a.
When “predict” method is called on the DAGNetwork in the CPU inference engine, the fully connected layer generates incorrect bias arrays in MATLAB releases prior to R2022b.
As a workaround, you can try upgrading to MATLAB R2022b or a later release.
I hope this helps resolve the error you are encountering.
0 个评论
另请参阅
类别
在 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!