Different result between `classify` and `classifyAndUpdateState`
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Xie Shipley
el 10 de Oct. de 2023
Respondida: Shubham
el 23 de Oct. de 2023
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 comentarios
Respuesta aceptada
Shubham
el 23 de Oct. de 2023
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!