【问题标题】:i did not resize the images我没有调整图像大小
【发布时间】:2020-08-19 07:51:33
【问题描述】:
NameError                                 Traceback (most recent call last)
<ipython-input-26-d130693892a2> in <module>

      7     image_path =  images_path + key

      8     image_array = cv2.imread(image_path)

----> 9     image_array = imresize(image_array, (48, 48))

     10     num_image_channels = len(image_array.shape)
     11 

               NameError: name 'imresize' is not defined

【问题讨论】:

    标签: python jupyter-notebook


    【解决方案1】:

    应该是这样的:

    image_array = cv2.resize(image_array, (48, 48))
    

    因为resize是cv2的函数

    【讨论】:

      【解决方案2】:

      尝试使用 cv2 导入

      import cv2
      

      然后改变

      image_array = imresize(image_array, (48,48)) 
      

      image_array = cv2.resize(image_array, (48,48))
      

      【讨论】:

      • 4 xtrain = np.array(x_train) / 255 ----> 5 xvalid = np.array(x_valid) / 255 6 7 #Reshape the input features(x_train) NameError: name 'x_valid ' 未定义
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-27
      • 2012-11-17
      • 2010-11-20
      • 1970-01-01
      相关资源
      最近更新 更多