嘿伙计们我正在使用tensorflow并希望传递新图像并找到它的预测以及图像。这是我的代码:
img = plt.figure(figsize=(32,32), tight_layout={"h_pad":4})
nc=len(set(y_ftest))
for i in range(nc):
k = np.where(y_ftest==i)
image = batch_x[k[0][0]]
prediction = pred.eval(feed_dict={x:X_ftest, y:y_ftest})
logit = sess.run(tf.argmax(logits, 1), feed_dict={x: X_ftest})
a = img.add_subplot(nc,2,i+1)
a.imshow(image, interpolation="None")
a.set_title(label_dict[logit[0+i]])
i+=1
这是我得到的错误
IndexError: index 0 is out of bounds for axis 0 with size 0
15 for i in range(nc):
16 k = np.where(y_ftest==i)
---> 17 image = batch_x[k[0][0]]