Code Monkey home page Code Monkey logo

nanodet-colaboratory-training-sample's Introduction

[Japanese/English]

Warning
このリポジトリはNanoDet-Plusには対応していません。

NanoDet-Colaboratory-Training-Sample


NanoDetをGoogle Colaboratory上で訓練しONNX形式のファイルをエクスポートするサンプルです。
以下の内容を含みます。

  • データセット ※アノテーション未実施
  • データセット ※アノテーション済み
  • Colaboratory用スクリプト(環境設定、モデル訓練)

Requirement

  • Pytorch 1.7 or later
  • pytorch-lightning 1.4.7 or later
  • OpenCV 3.4.2 or later ※推論サンプルを実施する場合のみ
  • onnxruntime 1.5.2 or later ※推論サンプルを実施する場合のみ

About annotation

VoTTを使用してアノテーションを行い、
Pascal VOC形式で出力したアノテーションデータを前提としています。
ただし、ノートブック内で更にMS COCO形式変換しています。

ノートブックのサンプルでは、以下のようなディレクトリ構成を想定しています。
ただし、本サンプルでは「pascal_label_map.pbtxt」と「ImageSets」は利用しないため、
格納しなくても問題ありません。

02.annotation_data
│  pascal_label_map.pbtxt
│  
├─Annotations
│      000001.xml
│       :
│      000050.xml
│      
├─ImageSets
│          
└─JPEGImages
        000001.jpg
         :
        000050.jpg

Usage

Open In Colab
トレーニングはGoogle Colaboratory上で実施します。
[Open In Colab]リンクからノートブックを開き、以下の順に実行してください。

  1. PyTorch Lightningインストール(PyTorch Lightning install)
  2. 乱数シード固定(Random seed fixed)
  3. データセットダウンロード(Download Dataset)
    自前のデータセットを使用したい方は「use_sample_image = True」をFalseに設定し、
    「dataset_directory」に自前のデータセットのパスを指定してください
  4. Pascal VOC形式 を MS COCO形式へ変換(Convert Pascal VOC format to MS COCO format)
  5. モデル訓練(Training Model)
    「!python train.py nanodet-m.yml」を実施する前に「nanodet」ディレクトリに「nanodet-m.yml」を格納してください。
    自前のデータセットを使用する場合「nanodet-m.yml」の以下の項目を変更してください。
    1. クラス数
      num_classes(model->arch->head->num_classes)
    2. 学習データ 画像格納パス
      img_path(data->train->img_path)
    3. 学習データ アノテーション格納パス
      ann_path(data->train->ann_path)
    4. 検証データ 画像格納パス
      img_path(data->val->img_path)
    5. 検証データ アノテーション格納パス
      ann_path(data->val->ann_path)
    6. バッチサイズ
      batchsize_per_gpu(device->batchsize_per_gpu)
    7. クラス名リスト
      class_names
  6. ONNX変換(Convert to ONNX)
  7. ONNXファイル情報確認(Check ONNX file information)
  8. 学習済ファイルダウンロード(Download Trained Model)

Author

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

License

NanoDet-Colaboratory-Training-Sample is under Apache-2.0 License.

nanodet-colaboratory-training-sample's People

Contributors

kazuhito00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

urankhatolaaa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.