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

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

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

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

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

YOLO

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

Q&A

解決済

2回答

1326閲覧

Windows 10 で YOLOv3 を自前画像で学習させる(物体検出編)【機械学習】困っています(-_-;)

ban.

総合スコア4

Windows 10

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

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

YOLO

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

0グッド

0クリップ

投稿2021/02/16 05:07

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ページで確認できます。

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

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

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

guest

回答2

0

ベストアンサー

voc_annotation.pyを実行した後でファイルを移動させたりしてませんか?

voc_annotation.pyはYOLOがデータを取ってくるときに必要なpathをまとめたファイルを作ります。
なのでファイルを作った時と場所が変わるとデータを取ってこれなくなります。

エラーの内容からpath通りに取りに行ったらデータがなかったよと言っているので多分そうなんじゃないかなと思いました。

model_data/2007_test.txtなどに書いてあるpathがファイルのpathを一致してるか確認してみてください。

投稿2021/02/16 08:41

kyokio

総合スコア560

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

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

ban.

2021/02/19 01:49

一応変えた覚えはありませんが。心当たりがあるとすれば参考文献の通り進めたのですが、オリジナルのモデルや画像をVOCdekitというフォルダにいれると書いてあったのでその通りにはしましたが、参考文献のほうはそれがもともとはいっていたみたいでしたが私は自分で作りました。そこだけが違うところです。
ban.

2021/02/19 04:18

ここがエラーの原因なのでしょうか?
kyokio

2021/02/19 09:57

僕もデータは自作してVOCdekitに入れました。僕は一回(全体の)ファイルを移動したためpathが代わりエラーが出ました。 pathは一致してました?
ban.

2021/02/20 00:28

VOCdekitのなかのAnnotationsというフォルダにannotationしたものが入っているのですが、それぞれの中身を見てみると、<path>C:/Users/std09/Desktop/im/image_001.jpg</path> という見覚えのないpathになっていました。ここですか?
kyokio

2021/02/20 09:07 編集

そうです! それはYOLOが画像を取ってくる時に必要なpathでvoc_annotation.pyを実行すると作られます。 そこに書いてあるpathと実際にimage_001.jpgがあるpathは一緒ですか? (そのpath通りにたどってimage_001.jpgにたどり着きますか?) VOCdekitのなかにimage_001.jpgとかが入ってるはずですがこのpathはDesktopの/imからimage_001.jpgを取ってこようとしているのでYOLOがpath通りに画像を取りに行ったけどなかったって感じだと思います。
ban.

2021/02/22 07:22

私は初心者なので微妙ですが、合わせてみました。しかし駄目でした。
guest

0

Windowsなのですね。
pythonの中で以下を実行してみてください。

python

1import os 2os.system('dir') 3os.system('dir image_015')

その結果を見れば、何が間違っているかがわかる可能性が大きいです。

投稿2021/02/16 05:24

ppaul

総合スコア24666

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

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

ban.

2021/02/16 05:29

(tf114) C:\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 os >>> os.system('dir') ドライブ C のボリューム ラベルがありません。 ボリューム シリアル番号は 22C2-9877 です C:\keras-yolo3\keras-yolo3-master のディレクトリ 2021/02/15 16:02 <DIR> . 2021/02/15 16:02 <DIR> .. 2021/01/21 10:04 1,201 .gitignore 2021/02/15 13:23 2,155 2007_test.txt 2021/02/15 13:23 2,155 2007_train.txt 2021/02/15 13:23 2,155 2007_val.txt 2020/12/01 14:11 7 classes.txt 2021/01/21 10:04 1,323 coco_annotation.py 2021/01/21 10:04 10,093 convert.py 2021/01/21 10:04 5,707 darknet53.cfg 2020/12/01 14:11 38 download.txt 2021/01/21 10:04 <DIR> font 2021/02/02 13:58 3,058 import cv2.txt 2021/02/05 10:28 720 import mysql.connector 2021/01/21 10:04 3,482 kmeans.py 2021/01/21 10:04 1,064 LICENSE 2021/02/05 09:51 <DIR> logs 2021/02/02 16:44 <DIR> model_data 2021/01/21 10:04 4,077 README.md 2021/01/21 10:04 8,332 train.py 2021/02/09 09:57 254 train.txt 2021/01/21 10:04 10,686 train_bottleneck.py 2021/02/05 10:28 2,539 Untitled-5.txt 2021/02/15 13:22 <DIR> VOCDevkit 2021/02/09 10:29 1,268 voc_annotation.py 2021/01/21 10:04 8,540 yolo.py 2021/02/01 15:17 <DIR> yolo3 2021/01/21 10:04 1,915 yolov3-tiny.cfg 2021/01/21 10:04 8,342 yolov3.cfg 2021/01/21 12:21 248,007,048 yolov3.weights 2021/01/21 10:04 2,304 yolo_video.py 2021/02/01 15:17 <DIR> __pycache__ 24 個のファイル 248,088,463 バイト 8 個のディレクトリ 365,158,780,928 バイトの空き領域 0 >>> os.system('dir image_015') ドライブ C のボリューム ラベルがありません。 ボリューム シリアル番号は 22C2-9877 です C:\keras-yolo3\keras-yolo3-master のディレクトリ ファイルが見つかりません 1 こう出てきました!
ban.

2021/02/16 05:48

こう出ましたが、keras-yolo3-masterの中のVOCDevkitというフォルダの中に入っています。
ppaul

2021/02/16 06:00

そうであれば、filenameには'VOCDevkit\image_015'を入れなければopenできないですね。
ban.

2021/02/16 06:38

逆にその中にすべていれて実行してみたのですがエラー内容は変わりませんでした。エラーが二つ出ているので、なにか環境構築の段階で間違えてしまったのでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問