-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
something went wrong when i was using the object_detection_tutorial.ipynb ,i cant get the result. #3786
Comments
Hi I got the same error. have you find the solution? |
Me too, any ideas for this? |
I have also got the same problem. Anybody found a solution? |
This is how I solved it. |
@Drgx96 ,Hi emmmmm,I just did as what you said ,but then I got another warnning , The backend was originally set to 'module://ipykernel.pylab.backend_inline' by the following code: if name == 'main': |
so have u found? cause i also tried that and got the same error like ur CallMe smth like' line for line in traceback.format_stack() |
I also have this problem. Did you fix it and how? |
commit:7a9934d has change the matplotlib imports, it cause object_det4ection_tutorial.ipynb to unable to run. This commit fixes the problem.
I clone the lastest tensorflow/model, still have this problem. |
I too fixed it by just commenting import matplotlib matplotlib.use('Agg') # pylint: disable=multiple-statements in visualization_utils.py file and by removing (matplotlib line -> from matplotlib import pyplot as plt) from bottom and placing it in the beginning of py file (object detection_tutorial.py) |
@majeedhussain49 Can you elaborate that fix. Please mail it to savantadarsh@gmail.com |
-cd tensorflow/models/research/object_detection/utils/ |
In latest API version, it has been like you say @tibro26 :
Still not work. |
I have a workaround for this issue. Just put the following code directly in the Python file that you're trying to run: import matplotlib; matplotlib.use('Agg') For instance I was trying to use model_main.py, so I changed the import section just below the from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import matplotlib; matplotlib.use('Agg')
from absl import flags
import tensorflow as tf
from object_detection import model_hparams
from object_detection import model_lib
..... This also fixed the following Tkinter threading exception: |
I don't think this is a fatal warning. My Program runs fine even with this warning. I,m using tensorflow 1.9 on python2 |
I got the same warning from the commit of 17fa528$ git log -1
|
I just removed the line in the first block that read |
Closing as this is resolved |
I restarted the kernel that imports |
This warning is still present. |
Update matplotlib and restart kernel worked for me. |
hi ,i was following the tutorial https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/ and i used jupyter to run the object_detection_tutorial.ipynb,but i cant get the same result as the tutorial did,iwent into the jupyter and run the command run all,but i get this when running part 3
utils/visualization_utils.py:25: UserWarning:
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://ipykernel.pylab.backend_inline' by the following code:
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelapp.py", line 486, in start
self.io_loop.start()
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 1009, in start
self._run_callback(self._callbacks.popleft())
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 760, in _run_callback
ret = callback()
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 536, in
self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0))
File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events
self._handle_recv()
File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv
self._run_callback(callback, msg)
File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python2.7/dist-packages/ipykernel/ipkernel.py", line 208, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python2.7/dist-packages/ipykernel/zmqshell.py", line 537, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2718, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2828, in run_ast_nodes
if self.run_code(code, result):
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 2, in
get_ipython().magic(u'matplotlib inline')
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2160, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2081, in run_line_magic
result = fn(*args,**kwargs)
File "", line 2, in matplotlib
File "/usr/local/lib/python2.7/dist-packages/IPython/core/magic.py", line 188, in
call = lambda f, *a, **k: f(*a, **k)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/magics/pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2950, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/pylabtools.py", line 309, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 231, in switch_backend
matplotlib.use(newbackend, warn=False, force=True)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/init.py", line 1410, in use
reload(sys.modules['matplotlib.backends'])
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/init.py", line 16, in
line for line in traceback.format_stack()
import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statements
can anyone explain why and help me fix it ,thank you so much~~
The text was updated successfully, but these errors were encountered: