且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在tensorflow.js中加载保存模型后,使用自定义模型获得错误的预测

更新时间:2023-10-15 13:54:46

该模型给出了错误的预测.该怎么办?

The model is giving wrong prediction. What to do ?

  • 检查模型的准确性.该模型的准确性非常低,表明该模型不是解决问题的正确模型,或者需要更改某些参数.

  • check the accuracy of the model. A very low accuracy of the model will indicate that the model is either not the right one for the problem solved or that some parameters needs to be changed.

即使准确性很好,模型在预测特定类别时也可能是错误的.在这种情况下,混淆矩阵将有助于识别错误预测的类别.确定了这些类别后,可以在训练后使用更多训练数据来提高这些类别的准确性

even if the accuracy is good the model can be wrong in predicting a particular class. In that case, the confusion matrix will be of a great help identify the classes incorrectly predicted. When those classes are identified, one can use more training data for those classes to improve their accuracy after the training

看问题的模型,很明显这是一个分类模型,即给定一个图像,该模型将预测该图像所属的类.

Looking at the model of the question it is clearly obvious that it is a classification model ie given an image, the model will predict the class the image belongs to.

'meanSquaredError'损失不是分类问题的***损失函数. categoricalCrossEntropy将达到***精度.即使更改了损失函数,精度仍可能不是预期的.然后,需要添加更多的层,更改模型的其他参数.然后人们将训练并比较精度,然后继续进行下去...

'meanSquaredError' loss is not the best loss function for classification problem. categoricalCrossEntropy will achieve best accuracy. Even after changing the loss function, the accuracy might still not be what is expected. Then one needs to add more layers, change other parameters of the model. Then one will train and compare the accuracy, and the cycle goes on...