tensorflow官方GitHub:https://github.com/tensorflow/models/tree/master/research/object_detection
背景:
将官方Object-Detection用PyCharm进行构建。官方给的实例可以用jupyter notebook直接运行object_detection_tutorial.ipynb来完成object的识别,而我想用pyCharm运行,于是尝试将object_detection_tutorial.ipynb中的代码复制粘贴出来形成新的脚本。
问题1:
在新的脚本中由于object_detection_tutorial.ipynb是用ipython实现的,所以 %matplotlib inline
不识别。
解决方法:
直接将这句去掉即可。(我是没发现有什么影响)。
问题2:
运行过程中报错:
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
放到最后就不会出现了。
github地址:https://github.com/zhonglihanzhu/tensorflow-objectDetection
网友评论