I am trying to run a image classification on Google Cloud Engine VM (via SSH login) model and trying to plot a graph for accuracy and loss. Model is running fine but getting error for graph plot. Below is code and error message.
Can anyone have idea how to fix this error in SSH Virtual Machine?
Tried 'tkagg' for matplotlib backend, but still getting the error.
Graph Code
import matplotlib matplotlib.use('tkagg')
import matplotlib.pyplot as plt
plot the training loss and accuracy
fig = plt.figure() plt.style.use("ggplot") plt.plot(np.arange(0, 10),
H.history["loss"], label="train_loss") plt.plot(np.arange(0, 10),
H.history["val_loss"], label="val_loss") plt.plot(np.arange(0, 10),
H.history["acc"], label="train_acc") plt.plot(np.arange(0, 10),
H.history["val_acc"], label="val_acc") plt.title("Training Loss and Accuracy")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend()
plt.savefig('without_aug.png', dpi = fig.dpi, bbox_inches = 'tight')
Error:
Traceback (most recent call last):
File "minivggnet_flowers17.py", line 73, in
fig = plt.figure()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 533, in figure
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 1046, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1823, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Can anyone have idea how to fix this error in SSH Virtual Machine?
deep-learning- kindly do not spam irrelevant tags (removed). - desertnaut