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

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

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

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

YOLO

YOLOとは、画像検出および認識用ニューラルネットワークです。CベースのDarknetというフレームワークを用いて、画像や動画からオブジェクトを検出。リアルタイムでそれが何になるのかを認識し、分類することができます。

機械学習

機械学習は、データからパターンを自動的に発見し、そこから知能的な判断を下すためのコンピューターアルゴリズムを指します。人工知能における課題のひとつです。

Q&A

1回答

2471閲覧

Windows 10 で YOLOv3 を自前画像で学習させる(物体検出編)【機械学習】

ban.

総合スコア4

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

YOLO

YOLOとは、画像検出および認識用ニューラルネットワークです。CベースのDarknetというフレームワークを用いて、画像や動画からオブジェクトを検出。リアルタイムでそれが何になるのかを認識し、分類することができます。

機械学習

機械学習は、データからパターンを自動的に発見し、そこから知能的な判断を下すためのコンピューターアルゴリズムを指します。人工知能における課題のひとつです。

0グッド

0クリップ

投稿2021/02/09 05:05

編集2021/02/16 05:06

Windows 10 で YOLOv3 を自前画像で学習させることを行っていますが以下のエラーが出てしまいました。助けてください。

(tf114) C:\keras-yolo3\keras-yolo3-master>python train.py
Using TensorFlow backend.
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:95: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.

WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:98: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:102: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-02-16 14:07:39.385171: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-02-16 14:07:39.389988: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2021-02-16 14:07:39.392874: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error
2021-02-16 14:07:39.397734: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: ELNET09
2021-02-16 14:07:39.399635: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: ELNET09
WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:1919: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.

Create YOLOv3 model with 9 anchors and 2 classes.
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((1, 1, 1024, 21) vs (255, 1024, 1, 1)).
weight_values[i].shape))
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((21,) vs (255,)).
weight_values[i].shape))
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((1, 1, 512, 21) vs (255, 512, 1, 1)).
weight_values[i].shape))
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((21,) vs (255,)).
weight_values[i].shape))
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((1, 1, 256, 21) vs (255, 256, 1, 1)).
weight_values[i].shape))
C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((21,) vs (255,)).
weight_values[i].shape))
Load weights model_data/yolo_weights.h5.
Freeze the first 249 layers of total 252 layers.
WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:3080: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
Train on 42 samples, val on 4 samples, with batch size 32.
Epoch 1/50
Traceback (most recent call last):
File "train.py", line 190, in <module>
_main()
File "train.py", line 65, in _main
callbacks=[logging, checkpoint])
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\training_generator.py", line 181, in fit_generator
generator_output = next(output_generator)
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 709, in get
six.reraise(*sys.exc_info())
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\six.py", line 703, in reraise
raise value
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 685, in get
inputs = self.queue.get(block=True).get()
File "C:\Users\std09\Anaconda3\envs\tf114\lib\multiprocessing\pool.py", line 657, in get
raise self._value
File "C:\Users\std09\Anaconda3\envs\tf114\lib\multiprocessing\pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 626, in next_sample
return six.next(_SHARED_SEQUENCES[uid])
File "train.py", line 175, in data_generator
image, box = get_random_data(annotation_lines[i], input_shape, random=True)
File "C:\keras-yolo3\keras-yolo3-master\yolo3\utils.py", line 39, in get_random_data
image = Image.open(line[0])
File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\PIL\Image.py", line 2904, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'image_015'
最後のエラーはやるたびにimage_015の数字が変わります。
[参考文献]
https://rightcode.co.jp/blog/information-technology/learn-yolov3-image-windows10-environment-construction#_YOLOv3

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

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

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

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

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

jbpb0

2021/02/09 05:34

エラーメッセージは、もっと続いてませんか? あと、「futurewarning:」と書かれてる行はエラーではないので、とりあえず無視して大丈夫です
ban.

2021/02/09 05:43

NameError: name 'phase' is not defined この一文が抜けていました。
jbpb0

2021/02/09 14:48

下記を実行したら、どうなりますか? もしエラーが出たら、エラーメッセージを教えてください import tensorflow as tf global _SESSION global _GRAPH_LEARNING_PHASES tf.reset_default_graph() _SESSION = None phase = tf.placeholder_with_default(False, shape=(), name='keras_learning_phase') _GRAPH_LEARNING_PHASES = {} _GRAPH_LEARNING_PHASES[tf.get_default_graph()] = phase もし上記を実行してエラーが出なければ、下記も実行して、結果を教えてください import keras.backend as K K.clear_session() あと、お使いのバージョンを教えてください Python tensorflow keras
ban.

2021/02/15 04:23

import tensorflow as tf と入力したら下記のようなエラーが出ました。私のこの入手方法はあっていますか? 'import' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 Python      3.7.9 Keras 2.2.4 tensorflow-gpu 1.14.0 でした。
jbpb0

2021/02/15 04:34 編集

Pythonで、実行してください 私が提示したコードをテキストファイルに保存して、ファイル名の拡張子を「.py」にします ファイル名は何でもいいのですが、たとえば「test_yolo.py」としたとすれば、 python test_yolo.py と実行します 実行する前に、「test_yolo.py」が置いてあるディレクトリに cd しておいてください
ban.

2021/02/15 04:36

すいません。返信してから気が付きました。 pythonで実行しました。すると以下のエラーが出ました。 >>> import keras.backend as K Using TensorFlow backend. >>> K.clear_session() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py", line 102, in clear_session _GRAPH_LEARNING_PHASES[tf.compat.v1.get_default_graph] = phase NameError: name 'phase' is not defined
jbpb0

2021/02/15 04:43 編集

それよりも上に8行書いてる方は、どうでしょうか? これです import tensorflow as tf global _SESSION global _GRAPH_LEARNING_PHASES tf.reset_default_graph() _SESSION = None phase = tf.placeholder_with_default(False, shape=(), name='keras_learning_phase') _GRAPH_LEARNING_PHASES = {} _GRAPH_LEARNING_PHASES[tf.get_default_graph()] = phase
ban.

2021/02/15 04:44

(tf114) C:\Users\std09\Downloads\keras-yolo3\keras-yolo3-master>python Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) >>> global _SESSION >>> global _GRAPH_LEARNING_PHASES >>> tf.reset_default_graph() >>> _SESSION = None >>> phase = tf.placeholder_with_default(False, shape=(), name='keras_learning_phase') >>> _GRAPH_LEARNING_PHASES = {} >>> _GRAPH_LEARNING_PHASES[tf.get_default_graph()] = phase 長くなりました。これで全てです。
jbpb0

2021/02/15 04:50 編集

こちらはエラー出ないですね >>> K.clear_session() > NameError: name 'phase' is not defined というエラーが出る「keras\backend\tensorflow_backend.py」の「clear_session()」から抜き出してきただけなのですが
ban.

2021/02/15 04:52

何か私がミスしてしまったのでしょうかね(-_-;)
jbpb0

2021/02/15 05:00

> Keras 2.2.4 の、 >>> import keras.backend as K >>> K.clear_session() > File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py", line 102, in clear_session > _GRAPH_LEARNING_PHASES[tf.compat.v1.get_default_graph] = phase > NameError: name 'phase' is not defined のエラーが出てるところは、 https://github.com/keras-team/keras/blob/2.2.4/keras/backend/tensorflow_backend.py の102行目で、それは88行目から定義されてる「clear_session()」という関数の最後の行です そこで、その関数の内容を取り出して実行していただきましたが、それではエラーが出ない なのに、「clear_session()」を実行したらエラー 何で??
ban.

2021/02/15 05:08

clear_session()のどこかが間違っているということでしょうか
jbpb0

2021/02/15 05:23

ご自身で触った心当たりが無いなら大丈夫だと思いますが、念の為に確認してください C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py をテキストエディタで開いて、それの88〜102行目を、 https://github.com/keras-team/keras/blob/2.2.4/keras/backend/tensorflow_backend.py の該当行と比べてみてください 98行目の「phase =...」の行が実行されたら「phase」に値が代入されるので、 > NameError: name 'phase' is not defined となるはず無いのですが なお、万が一、テキストエディタで何か変えてしまったら、ファイルを保存しないで終了してください
ban.

2021/02/15 05:40

少し違っていたので合わせて試していましたが、エラー内容は変わりませんでした。どうして出てしまうのでしょうか?全く分かりません
jbpb0

2021/02/15 05:52

> 少し違っていたので そんなはず無いです > Keras 2.2.4 を入れただけなら、 https://github.com/keras-team/keras/blob/2.2.4/keras/backend/tensorflow_backend.py と全く同じものが入るはずで、違うはず無いのですが、入れてるバージョン合ってますか? あるいは、お使いのPC内に複数のPythonやTensorFlowが入ってて、それらが混在して使われてる、ということはありませんか? Pythonで下記を実行して、結果を教えてください import sys import pprint pprint.pprint(sys.path) ユーザー名等の個人情報は伏せ字にして構いませんが、結果は省略せずに全部書いてください
ban.

2021/02/15 05:56

>>> pprint.pprint(sys.path) ['', 'C:\\Users\\std09\\Anaconda3\\envs\\tf114\\python37.zip', 'C:\\Users\\std09\\Anaconda3\\envs\\tf114\\DLLs', 'C:\\Users\\std09\\Anaconda3\\envs\\tf114\\lib', 'C:\\Users\\std09\\Anaconda3\\envs\\tf114', 'C:\\Users\\std09\\Anaconda3\\envs\\tf114\\lib\\site-packages'] このように出てきました
jbpb0

2021/02/15 06:02

sys.pathは問題無いようです ただ、「Keras 2.2.4」を入れたのに、入ってるものはgithubの2.2.4のソースと異なっているというのは、変です 入れたのは2.2.4で間違い無いのですよね? また、Kerasを入れた後に、自分でKerasのコードを触ったことはありませんよね?
ban.

2021/02/15 06:08

pip listです。 (tf114) C:\Users\std09\Downloads\keras-yolo3\keras-yolo3-master>pip list Package Version -------------------- ------------------- absl-py 0.11.0 astor 0.8.1 cached-property 1.5.2 certifi 2020.12.5 cycler 0.10.0 feedparser 6.0.2 gast 0.4.0 google-pasta 0.2.0 grpcio 1.34.1 h5py 2.10.0 importlib-metadata 3.4.0 Keras 2.2.4 Keras-Applications 1.0.8 Keras-Preprocessing 1.1.2 kiwisolver 1.3.1 Markdown 3.3.3 matplotlib 3.3.4 numpy 1.19.5 opencv-python 4.5.1.48 Pillow 8.1.0 pip 20.3.3 protobuf 3.14.0 pyparsing 2.4.7 python-dateutil 2.8.1 PyYAML 5.4.1 scipy 1.6.0 setuptools 51.1.2.post20210112 sgmllib3k 1.0.0 six 1.15.0 tensorboard 1.14.0 tensorflow-estimator 1.14.0 tensorflow-gpu 1.14.0 termcolor 1.1.0 typing-extensions 3.7.4.3 Werkzeug 1.0.1 wheel 0.36.2 wincertstore 0.2 wrapt 1.12.1 zipp 3.4.0 触った覚えはありませんが、karasを何度か入れなおしたことがあります。なので前のを使ってしまっている可能性というのはあるのでしょうか?
jbpb0

2021/02/15 06:21 編集

Pythonは一つしか入れてなくて、そこにKerasを入れ直したのでしたら、入れ直した時に古いのは消えるので、普通は大丈夫なはずです pip show Keras を実行して、その結果の下記で始まる行になんて書いてあるかを教えてください Version: Location:
ban.

2021/02/15 06:27

Version: 2.2.4 Location: c:\users\std09\anaconda3\envs\tf114\lib\site-packages でした。
jbpb0

2021/02/15 06:41

エラーメッセージや、sys.pathの結果と合わせると、Pythonは Location: のパスからKerasを読んでますので、pipで「入れたはず」のKeras 2.2.4を使ってますね ただし、Keras 2.2.4を入れたはずなのに、現状入っているのは2.2.4のgithubのソースコードとは違うものですよね 原因は分かりませんが、環境が壊れてるようです 他のファイルもそうなってるかもしれません 入れ直した時に、中途半端に前に入れてたものの一部のファイルだけ残ってしまったとか 今回のエラーの原因も、ファイルが合ってないことにあるかもしれないので、そのようなイレギュラーな状態でどうすればいいのか、すみませんが分かりません そのような変な状態になっているのがKerasだけかどうかも分かりませんし、Python環境を一から作り直した方がいいかもしれません おかしくなってるのがKerasだけなら、Kerasだけ強制再インストールすれば直るような気もしますが、同じ手順でインストールしたりアップデートしたりした他のモジュールも、同様なことが起きてるかもしれません
ban.

2021/02/15 06:49

困りましたね(-_-;)
ban.

2021/02/15 07:06

(tf114) C:\Users\std09\Downloads\keras-yolo3\keras-yolo3-master>python train.py Using TensorFlow backend. C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:95: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead. WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:98: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead. WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:102: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead. WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead. WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead. 2021-02-15 16:02:33.505306: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2021-02-15 16:02:33.510032: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll 2021-02-15 16:02:33.512914: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error 2021-02-15 16:02:33.518030: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: ELNET09 2021-02-15 16:02:33.519710: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: ELNET09 WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:1919: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead. Create YOLOv3 model with 9 anchors and 2 classes. C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((1, 1, 1024, 21) vs (255, 1024, 1, 1)). weight_values[i].shape)) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((21,) vs (255,)). weight_values[i].shape)) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((1, 1, 512, 21) vs (255, 512, 1, 1)). weight_values[i].shape)) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((21,) vs (255,)). weight_values[i].shape)) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((1, 1, 256, 21) vs (255, 256, 1, 1)). weight_values[i].shape)) C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\saving.py:1140: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((21,) vs (255,)). weight_values[i].shape)) Load weights model_data/yolo_weights.h5. Freeze the first 249 layers of total 252 layers. WARNING:tensorflow:From C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\backend\tensorflow_backend.py:3080: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where Train on 42 samples, val on 4 samples, with batch size 32. Epoch 1/50 Traceback (most recent call last): File "train.py", line 190, in <module> _main() File "train.py", line 65, in _main callbacks=[logging, checkpoint]) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\training.py", line 1418, in fit_generator initial_epoch=initial_epoch) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\engine\training_generator.py", line 181, in fit_generator generator_output = next(output_generator) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 709, in get six.reraise(*sys.exc_info()) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\six.py", line 703, in reraise raise value File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 685, in get inputs = self.queue.get(block=True).get() File "C:\Users\std09\Anaconda3\envs\tf114\lib\multiprocessing\pool.py", line 657, in get raise self._value File "C:\Users\std09\Anaconda3\envs\tf114\lib\multiprocessing\pool.py", line 121, in worker result = (True, func(*args, **kwds)) File "C:\Users\std09\Anaconda3\envs\tf114\lib\site-packages\keras\utils\data_utils.py", line 626, in next_sample return six.next(_SHARED_SEQUENCES[uid]) File "train.py", line 175, in data_generator image, box = get_random_data(annotation_lines[i], input_shape, random=True) File "C:\Users\std09\Downloads\keras-yolo3\keras-yolo3-master\yolo3\utils.py", line 39, in get_random_data image = Image.open(line[0]) IndexError: list index out of range エラー内容が変わっていました。
guest

回答1

0

物体検出やりたいなら以下のサイトがわかりやすくでおすすめです。
anaconda入れてるならだいたいのパッケージは入ってると思うので。
YOLOv3-Keras

投稿2021/02/14 13:41

編集2021/02/14 13:43
kyokio

総合スコア560

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

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

ban.

2021/02/15 04:41

回答ありがとうございます。今やっていることが解決できな場合参考にさせていただきます。ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問