我在python,pycharm中使用CNN设计图像分类器。我想在最后绘制精度图。以下是我绘制图表的代码:
hist = {
'Accuracy' : [x.value for x in ea.Scalars('Accuracy')],
'Validation Accuracy' : [x.value for x in ea.Scalars('Accuracy/Validation')],
'Loss' : [x.value for x in ea.Scalars('Loss')],
'Validation Loss' : [x.value for x in ea.Scalars
('Loss/Validation')]
}
fig = plt.figure()
keys = ['Accuracy', 'Loss', 'Validation Accuracy', 'Validation Loss']
for i,thing in enumerate(keys):
trace = hist[thing]
plt.subplot(2,2,i+1)
plt.plot(range(len(trace)), trace)
plt.title(thing)
fig.set_tight_layout(True)
fig
当我执行此代码时,我收到以下错误:
Traceback (most recent call last):
File "E:/VISION - CIFAR 10/CNN - CIFAR Ten/Trainig Model.py", line 4, in <module>
import ea as ea
File "C:\Users\Wahab Abid\CNN - CIFAR Ten\lib\site-packages \ea\__init__.py", line 1, in <module>
from ea import cqrs
File "C:\Users\Wahab Abid\CNN - CIFAR Ten\lib\site-packages\ea\cqrs \__init__.py", line 3, in <module>
from ea.cqrs.command import Command
File "C:\Users\Wahab Abid\CNN - CIFAR Ten\lib\site-packages\ea\cqrs\command\__init__.py", line 2, in <module>
from ea.cqrs.command.provider import CommandHandlerProvider
File "C:\Users\Wahab Abid\CNN - CIFAR Ten\lib\site-packages\ea\cqrs \command\provider.py", line 3, in <module>
import ioc.loader
ModuleNotFoundError: No module named 'ioc'
有人可以帮忙吗?我明白问题在于导入:
import ea as ea
我只是不明白如何解决它以及在哪里看。谢谢。
编辑:ncica下面的答案解决了这个问题,但现在它提供了另一个错误:
Traceback (most recent call last):
File "E:/VISION - CIFAR 10/CNN - CIFAR Ten/Trainig Model.py", line 157, in <module>
'Accuracy' : [x.value for x in ea.Scalars('Accuracy')],
AttributeError: module 'ea' has no attribute 'Scalars'
有人能帮忙吗?谢谢。