【发布时间】:2015-09-12 12:25:27
【问题描述】:
我正在开发 Caffe 框架并使用 PyCaffe 接口。我正在使用通过转换 IPython Notebook 00-classification.ipynb 获得的 Python 脚本来测试 ImageNet 训练模型的分类。但是脚本中的任何 get_ipython() 语句都会出现以下错误:
$ python python/my_test_imagenet.py
Traceback (most recent call last):
File "python/my_test_imagenet.py", line 23, in <module>
get_ipython().magic(u'matplotlib inline')
在脚本中,我正在导入以下内容:
import numpy as np
import matplotlib.pyplot as plt
get_ipython().magic(u'matplotlib inline')
# Make sure that caffe is on the python path:
caffe_root = '/path/to/caffe/'
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
import os
# ... Rest of the code...
有人可以帮我解决这个错误吗?
【问题讨论】:
-
你在哪里导入的?
-
我已经在我尝试使用'get_ipython()'语句的python脚本中导入了这个。
-
就我而言,我部署在 Azure 上托管的 Flask 应用程序上,不需要 ipython。我评论了。
标签: python ipython caffe pycaffe