Closed Jooseba closed 4 years ago
Could you share the whatever printed in your terminal? You should be able to see something there.
I had the same problem. And the printed information is in the following: from utils import label_map_util
from utils import visualization_utils as vis_util C:\pycharm\files\Object Detection\models\research\object_detection\utils\visualization_utils.py:27: 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 "c:\users\asus\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\asus\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\asus\appdata\local\programs\python\python36\lib\site-packages\ipykernel_launcher.py", line 16, in
import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statements
I know what was wrong. from matplotlib import pyplot as plt
should be changed into import matplotlib.pyplot as plt
The problem here seems to be importing of matplotlib in visualization_utils.py. Perhaps the APIs should simply take argument 'plt' defined by the notebook/caller.
Commenting out the matplotlib imports in the .py and keeping them in the notebook does draw. Not sure if there is any other way to solve this?.
Appartently there is problem with the models used. Use this line MODEL_NAME = 'faster_rcnn_resnet101_coco_2017_11_08' in the section "Model preparation". As for the matplotlib issues, it works fine for me without any changes. Hope this will help.
os: windows 10 python: python 3.6.8 | Anaconda 4.6.7 tensorflow gpu 1.12
@Jooseba Same issue, but when I execute the notebook again, then two images appear.
It seem matplotlib 3.0.2 cause the problem, try downgrade to 3.0.1 .
I know what was wrong.
from matplotlib import pyplot as plt
should be changed intoimport matplotlib.pyplot as plt
@JerryZhuzq
It works for me too! But why? What's the difference between the two sentences?
I know what was wrong.
from matplotlib import pyplot as plt
should be changed intoimport matplotlib.pyplot as plt
@JerryZhuzq It works for me too! But why? What's the difference between the two sentences?
Does not work for me.
I know what was wrong.
from matplotlib import pyplot as plt
should be changed intoimport matplotlib.pyplot as plt
@JerryZhuzq It works for me too! But why? What's the difference between the two sentences?Does not work for me.
Try my solution above.
I had same issue and I was getting this issue for both commands
from matplotlib import pyplot as plt import matplotlib.pyplot as plt but when it was not working I changed it to another command. it is for sure that one of it will work. so both of the commands are correct.
I have added in the images display cell %matplotlib inline before plt.figure(figsize=IMAGE_SIZE). vis_util.visualize_boxes_and_labels_on_image_array() is called before plt.figure() and it changes to Agg backend, visualization_utils.py line 29: import matplotlib; matplotlib.use('Agg'). I have also added at the end of the cell plt.show() to show all images. I'm using matplotlib 3.0.2.
I know what was wrong.
from matplotlib import pyplot as plt
should be changed intoimport matplotlib.pyplot as plt
Worked for me! Thanks!
I downgraded matplotlib
from 3.1.1
to 3.0.1
, I commented the two lines in the visualization_utils.py
, tried another model, used the %matplotlib inline
within the visulaization_utils.py
, changed the import maptlolib.pyplot
line and nothing seems to work.
Also not working for me after first using the latest version of protobuf. then downgraded it to v3.4.0
then I tried changing matplotlib.pyplot import.
then I tried downgrading matplotlib to version 3.0.1
still not working. console reads: [W 14:13:00.409 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200112141245 (::1) 14.00ms referer=http://localhost:8888/notebooks/object_detection/object_detection_tutorial.ipynb [I 14:13:01.299 NotebookApp] Kernel started: 31817f07-81f1-470a-a040-65e8b966f085 [I 14:15:02.135 NotebookApp] Saving file at /object_detection/object_detection_tutorial.ipynb
Also not working for me after first using the latest version of protobuf. then downgraded it to v3.4.0
then I tried changing matplotlib.pyplot import.
then I tried downgrading matplotlib to version 3.0.1
still not working. console reads: [W 14:13:00.409 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200112141245 (::1) 14.00ms referer=http://localhost:8888/notebooks/object_detection/object_detection_tutorial.ipynb [I 14:13:01.299 NotebookApp] Kernel started: 31817f07-81f1-470a-a040-65e8b966f085 [I 14:15:02.135 NotebookApp] Saving file at /object_detection/object_detection_tutorial.ipynb
I am facing the same problem. Did you manage to find a workaround?
I downgraded
matplotlib
from3.1.1
to3.0.1
, I commented the two lines in thevisualization_utils.py
, tried another model, used the%matplotlib inline
within thevisulaization_utils.py
, changed theimport maptlolib.pyplot
line and nothing seems to work.
Hello. Did you manage to get your model to work?
Hi all, Glad Im not the only one in this boat.
Same issue, no image displayed at the end, but no errors showing either. I commented out the matplotlib in utilit/visu.py and nothing changes if I do or dont comment it out.
I added %matplotlib inline before the output but no luck. Im on matplotlib 3.2.1 and unable to install version 3.0.1
Anyone any insights?
Try to comment this two lines in research/object_detection/utils/visualization_utils.py as described here: https://github.com/tensorflow/models/issues/6684. Worked for me on different pcs and without downgrading.
#import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statements
#import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top
After commenting out the 2 lines as shown below:
Need to perform the below as indicated in => https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html
cp object_detection/packages/tf2/setup.py . python -m pip install .
then it worked for me i.e the 2 pictures showed up.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.
Hi i am running into the same issues with the tutorials on https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/auto_examples/plot_object_detection_saved_model.html#sphx-glr-auto-examples-plot-object-detection-saved-model-py
I have tried the methods mentioned but nothing worked
So I have been straight now trying to install tensorflow with object_detection about 20h for two computers without any succsess. I don't get any errors but I haven't seen the dog and beach picture at all. Any suggestions why it is not working? Anyone else has this problem?
System informationg
Describe the problem
-I can start the object_detection_tutorial.ipynb, but I don't get the test images neither any error messages. It goes well to end of the script but the images are missing.
Source code / logs
-orginal code, straight from here.