The figure doesn't show up when using matplotlib with object detection API, But it works fine before I import some test method.
I'm using Anaconda virtual envionment, python 3.6 and the google object detection API.
import matplotlib.pyplot as plt
import tensorflow as tf
from matplotlib import patches
from object_detection.anchor_generators.multiple_grid_anchor_generator import create_ssd_anchors
from object_detection.models.ssd_mobilenet_v2_feature_extractor_test import SsdMobilenetV2FeatureExtractorTest
from object_detection.models.ssd_mobilenet_v2_feature_extractor_test import SsdMobilenetV2FeatureExtractorTest
The change happens when it comes to the last line
from object_detection.models.ssd_mobilenet_v2_feature_extractor_test import SsdMobilenetV2FeatureExtractorTest"
Before, I can show the figure, like plt.subplot(2,2), I get the figure pop up and the following:
(<Figure size 640x480 with 4 Axes>,
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f4615eb8ba8>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f4614d320f0>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f4614ce36a0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f4614c92c50>]],
dtype=object))
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
* https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.
and "plt.get_backend()" shows "Qt5Agg". but after the last line, the figure doesn't pop up, although I do get results from "plt.subplots(2,2)":
(<Figure size 640x480 with 4 Axes>,
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f460b8a5f60>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f460b86b5c0>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f460a7b2fd0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f460a7cb630>]],
dtype=object))
Now when I type "plt.get_backend()", it shows "Agg", not the previous "Qt5Agg". and "plt.show()" throws an error:
UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
#!/usr/bin/env python2
the interpreter I was using is
~/anaconda3/envs/py36/bin/python
Is there a shift of environment here?
The script for the last line can be found here
Thanks a lot for your time!