![](/img/trans.png)
[英]ValueError: x and y must have same first dimension, but have shapes (6,) and (8,)
[英]ValueError: x and y must have same first dimension, but have shapes (1,) and (224, 224, 3)
import os
import cv2
path1 = os.path.abspath('/content/drive/My Drive/dogbreed/test_set/n02085620-Chihuahua')
path2 = os.path.abspath('/content/drive/My Drive/dogbreed/test_set/n02085936-Maltese_dog')
path3 = os.path.abspath('/content/drive/My Drive/dogbreed/test_set/n02088238-basset')
folder = os.path.join(path1, path2, path3)
images = []
for filename in os.listdir(folder):
if filename.endswith(".jpg"):
img = cv2.imread(os.path.join(folder, filename))
if img is not None:
images.append(img)
from matplotlib import pyplot as plt
import numpy as np
img = np.array(images[0])
img = cv2.resize(img, (224, 224), interpolation = cv2.INTER_CUBIC)
plt.plot('image',img)
你的來電
plt.plot('image',img)
正在生成錯誤,因為第一個和第二個參數必須具有相同的維度。
也許,你應該考慮
plt.imshow(img)
替換這條線?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.