简体   繁体   English

Tensorflow CNN模型不训练吗? 持续的损失和准确性

[英]Tensorflow CNN model not training? Constant loss and accuracy

I have built a model using this as a base. 我已经以此为基础建立了一个模型。

And the train portion from this code . 并从该代码的火车部分。

This model does not train and always gives the cost/loss output for every iteration. 该模型不会训练,并且始终会为每次迭代提供成本/损失输出。

I dont think it learns anything. 我认为它没有学到任何东西。

I have checked for the usual stuff like shuffled inputs. 我已经检查了诸如混洗输入之类的常见内容。 Making sure that each batch is new. 确保每个批次都是新的。

Any idea why ? 知道为什么吗?

This is my code. 这是我的代码。

Output 输出量

Iter 1280, Minibatch Loss= 4.615120, Training Accuracy= 0.03125
Testing Accuracy: 0.0
Iter 2560, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.0
Iter 3840, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.015625
Iter 5120, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.078125
Iter 6400, Minibatch Loss= 4.615120, Training Accuracy= 0.03125
Testing Accuracy: 0.0
Iter 7680, Minibatch Loss= 4.615120, Training Accuracy= 0.03125
Testing Accuracy: 0.015625
Iter 8960, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.0
Iter 10240, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.015625
Iter 11520, Minibatch Loss= 4.615120, Training Accuracy= 0.00000
Testing Accuracy: 0.0
Iter 12800, Minibatch Loss= 4.615120, Training Accuracy= 0.01562
Testing Accuracy: 0.03125
Iter 14080, Minibatch Loss= 4.615120, Training Accuracy= 0.01562
Testing Accuracy: 0.0
Iter 15360, Minibatch Loss= 4.615120, Training Accuracy= 0.01562
Testing Accuracy: 0.0

The code you started from is just a benchmark of the forward and backward pass and isn't designed to do training. 您从中开始的代码只是前进和后退过程的基准,并不旨在进行培训。 You should start from an example that actually trains a model instead and ignore the benchmark code. 您应该从实际训练模型的示例开始,而忽略基准代码。

You might have an easier time starting from a completely working training example program instead of trying to combine two pieces. 从一个完全可以运行的培训示例程序开始,您可能会比较轻松,而不是尝试将两个部分组合在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM