我正在尝试将 png 文件读入在 docker 中运行的 python-flask 应用程序,并收到一条错误消息
ValueError:在模式“i”中找不到读取指定文件的格式
我已经使用 HTML 文件上传了一个文件,现在我正在尝试读取它以进行进一步处理。我看到 scipy.misc.imread 已被弃用,我正在尝试用 imageio.imread 替换它
if request.method=='POST':
file = request.files['image']
if not file:
return render_template('index.html', label="No file")
#img = misc.imread(file)
img = imageio.imread(file)
我收到此错误:
File "./appimclass.py", line 34, in make_prediction
img = imageio.imread(file)
File "/usr/local/lib/python3.6/site-packages/imageio/core/functions.py", line 221, in imread
reader = read(uri, format, "i", **kwargs)
File "/usr/local/lib/python3.6/site-packages/imageio/core/functions.py", line 139, in get_reader
"Could not find a format to read the specified file " "in mode %r" % mode