Google Colab - tensowflow 对象检测 API - "函数"对象没有属性"调用"



我尝试测试对象检测api model_builder_test.py。

时遇到以下错误。
!apt-get install -y -qq protobuf-compiler python-pil python-lxml
!git clone --quiet https://github.com/tensorflow/models.git
import os
os.chdir('models/research')
!protoc object_detection/protos/*.proto --python_out=.
import sys
sys.path.append('/content/models/research/slim')
%run object_detection/builders/model_builder_test.py

运行Modal_builder_test.py

后出现以下错误

.w0220 03:22:35.097244 140099951081344 rebecation.py:323]来自 /content/models/research/object_detection/anchor_generators/grid_anchor_generator.py:59: to_float(来自tensorflow.python.ops.math_ops)已弃用,将 在将来的版本中删除。更新的说明:使用tf.cast 反而。..警告:TensorFlow贡献模块不会 包含在Tensorflow 2.0中。有关更多信息,请参阅: * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md * https://github.com/tensorflow/addons如果您依赖在此处列出的功能,请提交问题。

.................. ------------------------------------------------------------------------------------------------------在0.203S中进行22次测试

确定(跳过= 1) ----------------------------------------------------------------------------------------------------------------属性Error Trackback(最近的电话 last)in() ----> 1 get_ipython()。魔术('run object_detection/builders/model_builder_test.py')

/usr/local/lib/python3.6/dist-packages/ipython/core/interactiveshell.py.py.py 在魔术(self,arg_s)中2158魔术_NAME,_,m giag_arg_s = arg_s.s.partition('')2159魔术_NAME = Magic_name.lstrip(prefilter.esc_magic) -> 2160 return self.run_line_magic(agiag_name,magic_arg_s)2161 2162

-------------------------------------------------------------------------------------------------------------------

/usr/local/lib/python3.6/dist-packages/ipython/core/interactiveshell.py.py.py 在run_line_magic(self,magic_name,line)2079
kwargs ['local_ns'] = sys._getFrame(stack_depth).f_locals 2080
与self.builtin_trap: -> 2081结果= fn(*args,** kwargs)2082返回结果2083

在运行(self,parameter_s,runner,file_finder)

/usr/local/lib/python3.6/dist-packages/ipython/core/magic.py in (f, *a,** k) 186#,但这只是一个州的过度杀伤。 187 def magic_deco(arg): -> 188呼叫= lambda f, *a,** k:f( *a,** k) 189 190如果可呼叫(arg):

/usr/local/lib/python3.6/dist-packages/ipython/core/magics/execution.py 在运行(self,parameter_s,runner,file_finder)中 740其他: 741#定期执行 -> 742 run() 743 744如果opts中的"我":

/usr/local/lib/python3.6/dist-packages/ipython/core/magics/execution.py 在run() 726 def Run(): 727 Runner(文件名,prog_ns,prog_ns, -> 728 exit_ignore = exit_ignore) 729 730如果opts中的" t":

/usr/local/lib/python3.6/dist-packages/ipython/core/pylabtools.py in mpl_execfile(fname, *其中,** kw) 175 matplotlib。Interactive(IS_ Interactive) 176#如果用户试图这样做,请立即进行渲染电话 -> 177如果plt.draw_if_interactive.called: 178 plt.draw() 179 plt.draw_if_interactive.called = false

attributeError:'function'对象没有属性''

这就是我克服问题的方式:

  1. 如下链接中所述https://github.com/jupyter/jupyter_console/issues/158

  2. 重新启动运行时激活软件包

  3. 使用'!python'而不是'%运行'

最新更新