My ONNX network doesn't work when loaded in my Java application
显示 更早的评论
Hi guys! I'm developping a Java application that uses a CNN, precisely an AlexNet. I followed these tutorials https://it.mathworks.com/matlabcentral/fileexchange/62990-deep-learning-tutorial-series , https://it.mathworks.com/help/deeplearning/ref/alexnet.html and https://it.mathworks.com/help/deeplearning/ref/trainnetwork.html . Now a weird thing occurs: I generated the network with a high accuracy (96.5% on a dataset "never seen before", that comes from the environment that the network is thought to work on). Next, I loaded the model in my Java application, using the OpenCV method readNetFromONNX ( https://docs.opencv.org/master/javadoc/org/opencv/dnn/Dnn.html ) but the network completely misclassifies. It's not a wrong coding of the classes, it simply "randomly" classifies. The thing is that, if I generate (with the same code, and same dataset) a network with a lower accuracy, maybe with a bad choice of training parameters (I mean about 90%), it works fine when loaded (by "fine" I mean at 90%, obviously). I thought it was overtraining, and, in fact, I trained the network with the test set getting an accuracy of (surprise surprise) 99.89%, but when I load it on my Java application (where, some inputs coming from the test set are given) the same thing occurs, it completely missclassifies everything that come as input. It's like Java doesn't accept the network that has a high accuracy.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!