tensorflow官方GitHub:https://github.com/tensorflow/models/tree/master/research/object_detection
背景:
將官方Object-Detection用PyCharm進(jìn)行構(gòu)建。官方給的實(shí)例可以用jupyter notebook直接運(yùn)行object_detection_tutorial.ipynb來(lái)完成object的識(shí)別,而我想用pyCharm運(yùn)行,于是嘗試將object_detection_tutorial.ipynb中的代碼復(fù)制粘貼出來(lái)形成新的腳本。
問(wèn)題1:
在新的腳本中由于object_detection_tutorial.ipynb是用ipython實(shí)現(xiàn)的,所以 %matplotlib inline不識(shí)別。
解決方法:
直接將這句去掉即可。(我是沒(méi)發(fā)現(xiàn)有什么影響)。
問(wèn)題2:
運(yùn)行過(guò)程中報(bào)錯(cuò):
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.
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from utils import label_map_util
from utils import ops as utils_ops
from utils import visualization_utils as vis_util
解決方法:
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from PIL import Image
from utils import label_map_util
from utils import ops as utils_ops
from utils import visualization_utils as vis_util
from matplotlib import pyplot as plt
將from matplotlib import pyplot as plt放到最后就不會(huì)出現(xiàn)了。
github地址:https://github.com/zhonglihanzhu/tensorflow-objectDetection