The training accuracy is very high, but the results are different every time when inferring the same picture?

By the way, when I used resnet for classification training, I found that the training output accuracy could reach 99%, but the inference was different every time.

I was careful and quickly discovered the problem: I trained with GPU, and of course I saved the GPU model. The inference does use the CPU directly, so the model loading error is certainly wrong.

solve:

torch.load("path to model", map_location="cpu")

おすすめ

転載: blog.csdn.net/qq_55542491/article/details/130134757