我想在不保存无花果的情况下将绘图图转换为数组
xl = pd.ExcelFile(file)
df1 = xl.parse('Sheet')
coups=np.log(df1['Y-Am'])
energy=df1['Energy (keV)']
fig=plt.figure()
val=plt.vlines(x=energie,ymin=0,ymax=coups,color='black')
可转换为数组的第二个代码
def load_image(img_path, show=False):
img = image.load_img(img_path, target_size=(128, 128))
img_tensor = image.img_to_array(img) #
(height, width, channels)
img_tensor = np.expand_dims(img_tensor, axis=0) # (1,
height, width, channels), add a dimension because the model
expects this shape: (batch_size, height, width, channels)
img_tensor /= 255.
return img_tensor
我需要它来进行CNN预测