All Projects → Kazuhito00 → NARUTO-HandSignDetection

Kazuhito00 / NARUTO-HandSignDetection

Licence: MIT license
物体検出を用いてNARUTOの印(子~亥、壬、合掌)を検出するモデルとサンプルプログラムです。このリポジトリでは、YOLOXを使用しています(This is a model and sample program that detects NARUTO's hand sign using object detection. This repository use YOLOX.)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to NARUTO-HandSignDetection

TFLite-ModelMaker-EfficientDet-Colab-Hands-On
TensorFlow Lite Model Makerで物体検出を行うハンズオン用資料です(Hands-on for object detection with TensorFlow Lite Model Maker)
Stars: ✭ 15 (-91.94%)
Mutual labels:  tensorflow-lite, tensorflow2
Tensorflow2-ObjectDetectionAPI-Colab-Hands-On
Tensorflow2 Object Detection APIのハンズオン用資料です(Hands-on documentation for the Tensorflow2 Object Detection API)
Stars: ✭ 33 (-82.26%)
Mutual labels:  tensorflow2, efficientdet
CRNN.tf2
Convolutional Recurrent Neural Network(CRNN) for End-to-End Text Recognition - TensorFlow 2
Stars: ✭ 131 (-29.57%)
Mutual labels:  tensorflow-lite, tensorflow2
Reinforcement Learning
Deep Reinforcement Learning Algorithms implemented with Tensorflow 2.3
Stars: ✭ 61 (-67.2%)
Mutual labels:  tensorflow2
tf-faster-rcnn
Tensorflow 2 Faster-RCNN implementation from scratch supporting to the batch processing with MobileNetV2 and VGG16 backbones
Stars: ✭ 88 (-52.69%)
Mutual labels:  tensorflow2
play with tflite
Sample projects for TensorFlow Lite in C++ with delegates such as GPU, EdgeTPU, XNNPACK, NNAPI
Stars: ✭ 222 (+19.35%)
Mutual labels:  tensorflow-lite
TrackNet-Badminton-Tracking-tensorflow2
TrackNet for badminton tracking using tensorflow2
Stars: ✭ 37 (-80.11%)
Mutual labels:  tensorflow2
tfworldhackathon
GitHub repo for my Tensorflow World hackathon submission
Stars: ✭ 17 (-90.86%)
Mutual labels:  tensorflow2
ttt
A package for fine-tuning Transformers with TPUs, written in Tensorflow2.0+
Stars: ✭ 35 (-81.18%)
Mutual labels:  tensorflow2
amazon-sagemaker-mlops-workshop
MLOps workshop with Amazon SageMaker
Stars: ✭ 39 (-79.03%)
Mutual labels:  tensorflow2
Keras-Android-XOR
How to run a Keras model on Android using Tensorflow API.
Stars: ✭ 32 (-82.8%)
Mutual labels:  tensorflow-lite
E2E-tfKeras-TFLite-Android
End to end training MNIST image classifier with tf.Keras, convert to TFLite and deploy to Android
Stars: ✭ 17 (-90.86%)
Mutual labels:  tensorflow-lite
Selfie2Anime-with-TFLite
How to create Selfie2Anime from tflite model to Android.
Stars: ✭ 70 (-62.37%)
Mutual labels:  tensorflow-lite
coral-pi-rest-server
Perform inferencing of tensorflow-lite models on an RPi with acceleration from Coral USB stick
Stars: ✭ 49 (-73.66%)
Mutual labels:  tensorflow-lite
scrabble-gan
Adversarial Generation of Handwritten Text Images
Stars: ✭ 49 (-73.66%)
Mutual labels:  tensorflow2
tensorflow-rbm
Tensorflow implementation of the Restricted Boltzmann Machine
Stars: ✭ 308 (+65.59%)
Mutual labels:  tensorflow2
Spectrum
Spectrum is an AI that uses machine learning to generate Rap song lyrics
Stars: ✭ 37 (-80.11%)
Mutual labels:  tensorflow2
gcnn keras
Graph convolution with tf.keras
Stars: ✭ 47 (-74.73%)
Mutual labels:  tensorflow2
deep reinforcement learning gallery
Deep reinforcement learning with tensorflow2
Stars: ✭ 35 (-81.18%)
Mutual labels:  tensorflow2
Deep-Learning
This repo provides projects on deep-learning mainly using Tensorflow 2.0
Stars: ✭ 22 (-88.17%)
Mutual labels:  tensorflow2

[Japanese/English]


NARUTO-HandSignDetection

物体検出を用いてNARUTOの印を検出するモデルとサンプルプログラムです。

 

右図:© NARUTO -ナルト- 9話『写輪眼のカカシ』岸本斉史作/集英社/studioぴえろ
日本の著作権法 第二十条「同一性保持権」1における「改変」に相当する可能性があるため、
 右図にはバウンディングボックスのオーバーレイ表示は行っておりません。


Title

Deep写輪眼:オブジェクト検出 YOLOX を用いた NARUTO の印認識

Abstract

このリポジトリは、NARUTO2 の印を認識するための訓練済みモデルとサンプルプログラムを公開しています。

忍術の発動は、一部の忍術をのぞき手で印を結ぶことが必要です。
また、性質変化は印に特徴が現れるため(火遁→寅の印、土遁→亥の印など)、
印を素早く認識することが出来れば、忍同士の戦闘においてアドバンテージを得ることが出来ます。
印の認識にはディープラーニングの物体検出モデルの一つYOLOX-Nanoを使用することで、
前回バージョンのDeep写輪眼(EfficientDet-D0利用)よりも推論速度を大幅にアップしました。

Requirements

  • onnxruntime 1.10.0 or Later
  • OpenCV 3.4.2 or Later
  • Pillow 6.1.0 or Later (Ninjutsu_demo.pyを動かす場合のみ)
  • Tensorflow 2.3.0 or Later (SSD、EfficientDetを動かす場合のみ)

DataSet

データセットについて

データセットは非公開です(訓練済みのモデルは公開します)
日本の著作権法 第四十七条の七「複製権の制限により作成された複製物の譲渡」3に準拠

また、自分で撮影した画像、アニメ画像の他に、naruto-hand-sign-dataset4を利用しています。

お願い事項

データセットはネット上で収集した画像と、自前で撮影した画像で構成されているため、
背景色や服装によっては検出精度が落ちたり、誤検出する可能性があります。
Issueで誤検出した条件を教えていただると助かります。
可能であれば、誤検出する条件の画像(子~亥、壬、合掌)をいただけると大変助かります。
その際、いただいた画像は学習データセットに追加してモデルの再訓練に使用します。

印の種類

14種類(子~亥、壬、合掌)の印に対応しています。

子(Ne/Rat) 丑(Ushi/Ox) 寅(Tora/Tiger) 卯(U/Hare)
辰(Tatsu/Dragon) 巳(Mi/Snake) 午(Uma/Horse) 未(Hitsuji/Ram)
申(Saru/Monkey) 酉(Tori/Bird) 戌(Inu/Dog) 亥(I/Boar)
壬(Mizunoe) 合掌(Gassho/Hnad Claps) - -

データセットの枚数

総枚数:10026(内アニメ画像:2651枚)
タグ付き枚数:7098枚
タグ無し枚数:2928枚
アノテーションボックス数:8941個
 

Trained Model

訓練済みモデルをmodelディレクトリ配下で公開しています。 ※旧バージョンのモデルは「_legacy」ディレクトリに移動

  • YOLOX-Nano

Directory

│  simple_demo.py
│  Ninjutsu_demo.py
│  
├─model
│  └─yolox
│      │ yolox_nano.onnx
│      └─yolox_onnx.py
│              
├─setting─┬─labels.csv
│         └─jutsu.csv
│      
├─utils
│          
└─_legacy

simple_demo.py

 シンプルな検出デモです。
 

Ninjutsu_demo.py

 忍術判定のデモです。
 印の履歴から術データ(jutsu.csv)にマッチする術名を表示します。
   

model

 訓練済みモデルを格納しています。

setting

 ラベルデータ(labels.csv)と術名データ(jutsu.csv)を格納しています。

  • labels.csv
    印のラベル名を保持しています。
    • A列:英語の印
    • B列:日本語の印
  • jutsu.csv
    術名と必要印を保持しています。
    • A列:日本語の術種別(火遁等)
    • B列:英語の術種別(火遁等)
    • C列:日本語の術名
    • D列:英語の術名
    • E列以降:術の発動に必要な印

utils

 FPS計測用モジュール(cvfpscalc.py)と文字列描画用モジュール(cvdrawtext.py)を格納しています。
 Ninjutsu_demo.pyのみで使用します。

Usage

デモの実行方法は以下です。

python simple_demo.py
python Ninjutsu_demo.py

また、デモ実行時には、以下のオプションが指定可能です。

オプション指定
  • --device
    カメラデバイス番号の指定
    デフォルト:
    • simple_demo.py:0
    • Ninjutsu_demo.py:0
  • --file
    動画ファイル名の指定 ※指定時はカメラデバイスより優先し動画を読み込む
    デフォルト:
    • simple_demo.py:None
    • Ninjutsu_demo.py:None
  • --fps
    処理FPS ※推論時間がFPSを下回る場合のみ有効
    デフォルト:
    • simple_demo.py:30
    • Ninjutsu_demo.py:30
  • --width
    カメラキャプチャ時の横幅
    デフォルト:
    • simple_demo.py:960
    • Ninjutsu_demo.py:960
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:
    • simple_demo.py:540
    • Ninjutsu_demo.py:540
  • --skip_frame
    カメラ or 動画読み込み時に何枚おきに処理を実行するか
    デフォルト:
    • simple_demo.py:0
    • Ninjutsu_demo.py:0
  • --model
    ロードするモデルの格納パス
    デフォルト:
    • simple_demo.py:model/yolox/yolox_nano.onnx
    • Ninjutsu_demo.py:model/yolox/yolox_nano.onnx
  • --input_shape
    モデルの入力サイズ
    デフォルト:
    • simple_demo.py:416,416
    • Ninjutsu_demo.py:416,416
  • --score_th
    クラス判別の閾値
    デフォルト:
    • simple_demo.py:0.7
    • Ninjutsu_demo.py:0.7
  • --nms_th
    NMSの閾値
    デフォルト:
    • simple_demo.py:0.45
    • Ninjutsu_demo.py:0.45
  • --nms_score_th
    NMSのスコア閾値
    デフォルト:
    • simple_demo.py:0.1
    • Ninjutsu_demo.py:0.1
  • --sign_interval
    前回の印検出時から指定時間(秒)経過すると印の履歴をクリア
    デフォルト:
    • Ninjutsu_demo.py:2.0
  • --jutsu_display_time
    術成立時に術名を表示する時間(秒)
    デフォルト:
    • Ninjutsu_demo.py:5
  • --use_display_score
    印検出スコアを表示するか否か
    デフォルト:
    • Ninjutsu_demo.py:False
  • --erase_bbox
    バウンディングボックスのオーバーレイ表示を消去するか否か
    デフォルト:
    • Ninjutsu_demo.py:False
  • --use_jutsu_lang_en
    術名表示に英語表記を使用するか否か
    デフォルト:
    • Ninjutsu_demo.py:False
  • --chattering_check
    印を何回連続で検出したら印の成立とみなすか(印の検出チラつき対策)
    デフォルト:
    • Ninjutsu_demo.py:1
  • --use_fullscreen
    フルスクリーン表示を利用するか否か(試験的機能)
    デフォルト:
    • Ninjutsu_demo.py:False

Application Example

アプリケーションの応用事例を紹介します。

Acknowledgements

EfficientDetモデルトレーニング時は、からあげさんの説明記事5を参考にいたしました。
また、からあげさんのブログ6にて、Deep写輪眼をご紹介いただきました。
大変ありがとうございます。

YOLOXのトレーニングにはYOLOX-Colaboratory-Training-Sample7を使用しています。

References

  1. ^日本:著作権法 第二十条「同一性保持権」
  2. ^岸本斉史作『NARUTO』集英社、1999年-2014年
  3. ^日本:著作権法 四十七条の七「複製権の制限により作成された複製物の譲渡」
  4. ^Kaggle 公開データセット:naruto-hand-sign-dataset
  5. ^「Object Detection API」で物体検出の自前データを学習する方法(TensorFlow 2.x版)
  6. ^からあげさんのブログ:AIでNARUTO気分!「Deep写輪眼」で遊んでみよう
  7. ^Kazuhito00/YOLOX-Colaboratory-Training-Sample

Authors

高橋かずひと(https://twitter.com/KzhtTkhs)

License

NARUTO-HandSignDetection is under MIT license.

License(Font)

衡山毛筆フォント(https://opentype.jp/kouzanmouhitufont.htm)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].