質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Matplotlib

MatplotlibはPythonのおよび、NumPy用のグラフ描画ライブラリです。多くの場合、IPythonと連携して使われます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

2211閲覧

ssd_kerasのSSD.ipyndをjupyter notebookでRunするとエラーが起きます

Tello-python

総合スコア6

Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Matplotlib

MatplotlibはPythonのおよび、NumPy用のグラフ描画ライブラリです。多くの場合、IPythonと連携して使われます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2019/10/11 05:06

編集2019/10/11 05:11

前提・実現したいこと

Telloのカメラからリアルタイムに物体認識を行うためssd_kerasを動かしたいです。
Telloを動かすのはTelloPyを用いようと考えています。

発生している問題・エラーメッセージ

AttributeError Traceback (most recent call last) <ipython-input-53-4ea723c8f5e8> in <module>() 37 currentAxis.text(xmin, ymin, display_txt, bbox={'facecolor':color, 'alpha':0.5}) 38 ---> 39 plt.show() ~\Anaconda3\envs\py3.5.2\lib\site-packages\matplotlib\pyplot.py in show(*args, **kw) 250 """ 251 global _show --> 252 return _show(*args, **kw) 253 254 ~\Anaconda3\envs\py3.5.2\lib\site-packages\ipykernel\pylab\backend_inline.py in show(close, block) 37 display( 38 figure_manager.canvas.figure, ---> 39 metadata=_fetch_figure_metadata(figure_manager.canvas.figure) 40 ) 41 finally: ~\Anaconda3\envs\py3.5.2\lib\site-packages\ipykernel\pylab\backend_inline.py in _fetch_figure_metadata(fig) 172 """Get some metadata to help with displaying a figure.""" 173 # determine if a background is needed for legibility --> 174 if _is_transparent(fig.get_facecolor()): 175 # the background is transparent 176 ticksLight = _is_light([label.get_color() ~\Anaconda3\envs\py3.5.2\lib\site-packages\ipykernel\pylab\backend_inline.py in _is_transparent(color) 193 def _is_transparent(color): 194 """Determine transparency from alpha.""" --> 195 rgba = colors.to_rgba(color) 196 197 return rgba[3] < .5 AttributeError: module 'matplotlib.colors' has no attribute 'to_rgba'

該当のソースコード

Python3.5.2

1for i, img in enumerate(images): 2 # Parse the outputs. 3 det_label = results[i][:, 0] 4 det_conf = results[i][:, 1] 5 det_xmin = results[i][:, 2] 6 det_ymin = results[i][:, 3] 7 det_xmax = results[i][:, 4] 8 det_ymax = results[i][:, 5] 9 10 # Get detections with confidence higher than 0.6. 11 top_indices = [i for i, conf in enumerate(det_conf) if conf >= 0.6] 12 13 top_conf = det_conf[top_indices] 14 top_label_indices = det_label[top_indices].tolist() 15 top_xmin = det_xmin[top_indices] 16 top_ymin = det_ymin[top_indices] 17 top_xmax = det_xmax[top_indices] 18 top_ymax = det_ymax[top_indices] 19 20 colors = plt.cm.hsv(np.linspace(0, 1, 21)).tolist() 21 22 plt.imshow(img / 255.) 23 currentAxis = plt.gca() 24 25 for i in range(top_conf.shape[0]): 26 xmin = int(round(top_xmin[i] * img.shape[1])) 27 ymin = int(round(top_ymin[i] * img.shape[0])) 28 xmax = int(round(top_xmax[i] * img.shape[1])) 29 ymax = int(round(top_ymax[i] * img.shape[0])) 30 score = top_conf[i] 31 label = int(top_label_indices[i]) 32 label_name = voc_classes[label - 1] 33 display_txt = '{:0.2f}, {}'.format(score, label_name) 34 coords = (xmin, ymin), xmax-xmin+1, ymax-ymin+1 35 color = colors[label] 36 currentAxis.add_patch(plt.Rectangle(*coords, fill=False, edgecolor=color, linewidth=2)) 37 currentAxis.text(xmin, ymin, display_txt, bbox={'facecolor':color, 'alpha':0.5}) 38 39 plt.show()

試したこと

matplolibを--upgradeしてバージョンを新しくすると異なるところでバージョンの不一致とエラーが出ました...

Lib\site-packages\ipykernel\pylab\backend_inline.pyの146~148行目に
"""
Changes to matplotlib in version 1.2 requires a mpl backend to supply a default
figurecanvas. This is set here to a Agg canvas
See https://github.com/matplotlib/matplotlib/pull/1125
"""
と記載があったのでmatplotlib=1.2.0を入れようとするとこれまたエラーが起きました...

補足情報(FW/ツールのバージョンなど)

Keras:2.0.1
opencv-python:3.1.0.0
ssd:1.0.0
tensorflow:1.0.0
python:3.5.2
matplotlib:1.5.3
windows10
SnowMasaya/ssd_keras

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

Anacondaを入れ直したらエラーが起きなくなりました。

投稿2019/10/11 15:16

Tello-python

総合スコア6

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問