Different result between `classify` and `classifyAndUpdateState`
조회 수: 2 (최근 30일)
이전 댓글 표시
I have trained a model and have good accuracy while doing forward inference, using `classify(net, feature_big)` I will get correnct result, using ` [net, ~, scores] = classifyAndUpdateState(net, features_4frame, "MiniBatchSize",1)` will give me a wrong result, Can someone help me with this problem??
NOTE:
- the input of net is sequenceInputLayer(64, MinLength=4), very similar to `crnn` used in `detectspeechnn`
- `feature_big` has shape 64x16000, 64 is channel, 16000 is sequence length. `feature_4frame` has shape 64x4
Any advice and help would be greatly appreciated.
댓글 수: 0
채택된 답변
Shubham
2023년 10월 23일
Hi Xie,
There are a few possible reasons why the classifyAndUpdateState function might be giving you different results than the classify function, even though you are using the same model and input data.
One possibility is that the classifyAndUpdateState function is using a different batch size than the classify function. The default batch size for the classifyAndUpdateState function is 1, but you can specify a different batch size using the MiniBatchSize option. If you are using a different batch size for the two functions, then you may get different results, especially if your model is sensitive to batch size.
Another possibility is that the classifyAndUpdateState function is updating the state of the model, while the classify function does not. This means that the classifyAndUpdateState function may be taking into account the previous inputs to the model when making its predictions, while the classify function is only considering the current input. If your input data is sequential, then this difference in behavior could lead to different predictions.
Evaluate on multiple samples: Instead of evaluating on a single sample at a time, try evaluating on multiple samples (e.g., using a mini-batch) to see if the issue persists. This can help identify whether the problem is related to a specific input sample or a more general issue.
댓글 수: 0
추가 답변 (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!