Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用train.py从零开始训练出现UnboundLocalError: local variable 'summary_val' referenced before assignment #10

Open
imliusu opened this issue Oct 13, 2019 · 3 comments

Comments

@imliusu
Copy link

imliusu commented Oct 13, 2019

在使用 train.py 从头开始训练时,出现
Step: 1/9, accuracy: 0.155556, center loss: 0.998996, cross loss: 2.833399, Total Loss: 9.798814 ,lr:0.010000
Traceback (most recent call last):
File "train.py", line 283, in
main()
File "train.py", line 201, in main
val_writer.add_summary(summary_val, global_step=epoch)
UnboundLocalError: local variable 'summary_val' referenced before assignment

尝试加入 global summary_val 依然报错

@imliusu imliusu changed the title UnboundLocalError: local variable 'summary_val' referenced before assignment 使用train.py从零开始训练出现UnboundLocalError: local variable 'summary_val' referenced before assignment Oct 13, 2019
@LeslieZhoa
Copy link
Owner

loss_val,center_loss_val,cross_entropy_mean_val,accuracy_val,summary_val=sess.run ([total_loss,prelogits_center_loss,cross_entropy_mean, accuracy,summary_op], feed_dict=feed_dict)

如果你没有修改这里,应该不会有错,希望对你有所帮助

@yimuart
Copy link

yimuart commented Mar 9, 2022

你好,我也遇到了同样的问题,尝试无果,请问你解决这个问题了吗?我想请问如何解决的?谢谢!

在使用 train.py 从头开始训练时,出现 Step: 1/9, accuracy: 0.155556, center loss: 0.998996, cross loss: 2.833399, Total Loss: 9.798814 ,lr:0.010000 Traceback (most recent call last): File "train.py", line 283, in main() File "train.py", line 201, in main val_writer.add_summary(summary_val, global_step=epoch) UnboundLocalError: local variable 'summary_val' referenced before assignment

尝试加入 global summary_val 依然报错

@imliusu
Copy link
Author

imliusu commented Mar 12, 2022

你好,可以检查数据集数量是否符合一定比例?忘记是偶数还是三倍了。
我有点忘了是数据集数量不足还是这个倍数问题,可以都尝试一下看看能不能解决。

你好,我也遇到了同样的问题,尝试无果,请问你解决这个问题了吗?我想请问如何解决的?谢谢!

在使用 train.py 从头开始训练时,出现 Step: 1/9, accuracy: 0.155556, center loss: 0.998996, cross loss: 2.833399, Total Loss: 9.798814 ,lr:0.010000 Traceback (most recent call last): File "train.py", line 283, in main() File "train.py", line 201, in main val_writer.add_summary(summary_val, global_step=epoch) UnboundLocalError: local variable 'summary_val' referenced before assignment
尝试加入 global summary_val 依然报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants