我没能显示图像, 代码下方,
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import cv2
import os
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.preprocessing import image
from tensorflow.keras.optimizers import RMSprop
img= image.load_img("cnn_happy_notHappy/traing/happy/1.png")
错误:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-13-2c0e7bdac5f8> in <module>()
----> 1 img= image.load_img("cnn_happy_notHappy/traing/happy/1.png")
1 frames
/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/utils.py in load_img(path, grayscale, color_mode, target_size, interpolation)
111 raise ImportError('Could not import PIL.Image. '
112 'The use of `load_img` requires PIL.')
--> 113 with open(path, 'rb') as f:
114 img = pil_image.open(io.BytesIO(f.read()))
115 if color_mode == 'grayscale':
FileNotFoundError: [Errno 2] No such file or directory: 'cnn_happy_notHappy/traing/happy/1.png'
请帮我解决这个问题,
您可以先在google colab中导入图像,然后将其分配给img变量
相关问题 更多 >
编程相关推荐