Help us understand the problem. What is going on with this article?

YOLOv3を独自データセットで学習させるメモ

実行環境

  • Windows10
  • GTX1080Ti
  • CUDA
  • CuDNN
  • Python
  • Tensorflow-gpu
  • Keras
  • opencv-python
  • matplotlib
  • Pillow

※環境構築詳細はここ
https://qiita.com/hina2211/private/062fabc19b82c8dbb9d0

YOLOv3環境構築

ソースをダウンロード
git clone https://github.com/qqwweee/keras-yolo3.git

学習済みモデルをダウンロード
wget https://pjreddie.com/media/files/yolov3.weights

weightsをkeras用に変換
python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5

静止画で評価

python yolo_video.py --image xxx.jpg

動画で評価

python yolo_video.py --input xxx.mp4

教師画像にアノテーションする

https://github.com/tzutalin/labelImg

データセットの配置

アノテーション .xml
keras-yolo3/VOCDevkit/VOC2007/Annotations
---xxx_001.xml
---xxx_002.xml
---xxx_003.xml
画像 .jpg
keras-yolo3/VOCDevkit/VOC2007/JPEGImages
---xxx_001.jpg
---xxx_002.jpg
---xxx_003.jpg

keras-yolo3/VOCDevkit/VOC2007/ImageSets/Main
train.txt、val.txt、test.txt

以下のようにファイル名から拡張子を除いたものを列挙
注)最終行にも改行が必要
xxx_001
xxx_002
xxx_003

6行目のclasses=[]を自分のリストに変更

voc_annotation.py(line6)
classes = ["item1","item2"]

YOLOv3のアノテーションに変換

python voc_annotation.py

3つのファイルが作成されます
 2007_train.txt
 2007_val.txt
 2007_test.txt

weightsのコンバート

python convert.py -w yolov3.cfg yolov3.weights model_data/yolo_weights.h5

train.pyの修正

annotation_path に 2007_train.txt
classes_path に model_data/my_classes.txt

学習の実行

python train.py

学習済みモデルができあがります
logs/000/trained_weights_final.h5

動画の評価

python yolo_video.py --model logs/000/trained_weights_final.h5 --classes model_data/my_classes.txt --input xxxx.mp4

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした