使用pycocotools.coco後plt不顯示圖像的問題

若在coco import之後再import matplotlib,那麼plt就不顯示圖像了,若想顯示圖像,需在其之前import。

This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to 'module://backend_interagg' by the following code:
  File "E:/Ship_Detection/SSDD-Dataset-Analysis/debug_count_size_distribution.py", line 10, in <module>
    import matplotlib.pyplot as plt
  File "C:\Software\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 71, in <module>
    from matplotlib.backends import pylab_setup
  File "C:\Software\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 16, in <module>
    line for line in traceback.format_stack()


  import matplotlib; matplotlib.use('Agg')

coco 中會將matplotlib.use()中修改從而影響plt顯示。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章