[Japanese/English]
Tensorflow2 Object Detection APIで作成したFinger Frame検出用のモデルです。
現在はEfficientDet D0のモデルを公開しています。
このリポジトリはデータセット・訓練済みモデルを含み、サイズが約2.9 GBあるため、クローンする際には注意ください。
- Tensorflow 2.3.0 or later
- OpenCV 3.4.2 or later
Webカメラを使った推論デモの実行方法は以下です。
python webcam_demo.py
推論を実行するだけであれば、以下のみで実行可能です。
- webcam_demo.py
- 04_model ディレクトリ
また、デモ実行時には、以下のオプションが指定可能です。
- --device
カメラデバイス番号の指定 (デフォルト:0) - --width
カメラキャプチャ時の横幅 (デフォルト:960) - --height
カメラキャプチャ時の縦幅 (デフォルト:540) - --model
モデル読み込みパス (デフォルト:'04_model/EfficientDetD0/saved_model') - --score_th
検出閾値 (デフォルト:0.75) - --fps
処理FPS (デフォルト:10) ※推論時間がFPSを下回る場合のみ有効
│ [Colaboratory]train.ipynb │ webcam_demo.py │ ├─01_dataset │ ├─annotation─┬─FingerFrameDetection-export.csv │ │ └─FingerFrameDetection-export.json │ │ │ └─image──────┬─000000.jpg │ │ : │ └─003471.jpg │ ├─02_tfrecord───┬─000000.tfrecord │ │ : │ ├─003471.tfrecord │ └─tf_label_map.pbtxt │ ├─03_config───efficientdet_d0_pipeline.config │ └─04_model───EfficientDetD0─┬─pipeline.config ├─checkpoint──┬─checkpoint │ ├─ckpt-0.data-00000-of-00001 │ └─ckpt-0.index └─saved_model─┬─saved_model.pb └─variables─┬─variables.data-00000-of-00001 └─variables.index
モデル訓練用スクリプトです。
Google Colaboratory上のみで訓練とモデルのエクスポートまで行います。
訓練中のチェックポイントとエクスポートモデルはGoogleドライブ上に保存します。
推論用のサンプルプログラムです。
画像データセットとアノテーションファイルを格納しています。
アノテーションファイルはVoTTで作成しています。
- imageディレクトリ
- annotationディレクトリ
- FingerFrameDetection-export.csv
- FingerFrameDetection-export.json
アノテーション済みデータセットをTFRecordに変換し格納しています。 TFRecordとtf_label_map.pbtxtはVoTTで作成しています。
ファインチューニング用のパイプラインコンフィグを格納しています。
- efficientdet_d0_pipeline.config
ファインチューニング済モデルを格納しています。
- EfficientDetD0
Colaboratory上でモデル訓練を行うスクリプトです。
上から順に実施してください。
モデルのエクスポートはGoogleドライブに行います。
Colaboratory上での訓練は1000ステップで30分程度です。
収束するまでに10000ステップほど必要ですが、1000ステップ程度でも、そこそこ検出するようになります。
- SSD MobileNet v2 320x320 訓練
高橋かずひと(https://twitter.com/KzhtTkhs)
FingerFrameDetection-TF2 is under MIT license.