Skip to content

Latest commit

 

History

History
65 lines (55 loc) · 2.96 KB

README_EN.md

File metadata and controls

65 lines (55 loc) · 2.96 KB

[Japanese/English]

YOLOX-Colaboratory-Training-Sample


This is a sample to train YOLOX on Google Colaboratory and export a file in ONNX format and TensorFlow-Lite format.
It includes the following contents.

  • Data set(Annotation not implemented)
  • Data set(Annotated)
  • Colaboratory script (environment setting, model training)
  • ONNX inference sample

Requirement

  • Pytorch 1.9.0 or later
  • apex 0.1 or later
  • pycocotools 2.0 or later
  • OpenCV 3.4.2 or later
  • onnxruntime 1.5.2 or later ※Only when performing inference samples

About annotation

It is assumed that annotation data is annotated using VoTT and output in Pascal VOC format.
However, it is further converted to MS COCO format in the notebook.

The notebook sample assumes the following directory structure.
However, since "pascal_label_map.pbtxt" is not used in this sample,
There is no problem even if you do not store it.

02.annotation_data
│  000001.jpg
│  000001.xml
│  000002.jpg
│  000002.xml
│   :
│  000049.jpg
│  000049.xml
│  000050.xml
└─ pascal_label_map.pbtxt
  

Usage

Open In Colab
Training will be conducted on Google Colaboratory.
Open your notebook from the [Open In Colab] link and run it in the following order:

  1. YOLOX 依存パッケージインストール(YOLOX Dependent Package Install)
  2. NVIDIA APEXインストール(NVIDIA APEX Install)
  3. PyCocoToolsインストール(PyCocoTools Install)
  4. データセットダウンロード(Download Dataset)
    If you want to use your own dataset, set "use_sample_image = True" to False and specify the path of your own dataset in
    "dataset_directory".
  5. Pascal VOC形式 を MS COCO形式へ変換(Convert Pascal VOC format to MS COCO format)
  6. モデル訓練(Training Model)
    Please store "ano.py" in the "YOLOX" directory before executing "!python train.py".
    When using your own data set, change the following items in "nanodet-m.yml".
    1. Number of classes
      self.num_classes
    2. Image storage path
      self.data_dir
    3. Training data annotation file
      self.train_ann
    4. Validation data annotation file
      self.val_ann
    5. Number of epochs
      self.max_epoch
  7. 推論テスト(Inference test)
  8. ONNX変換(Convert to ONNX)

※The original file of "nano.py" is stored in "Megvii-BaseDetection/YOLOX/exps/default"

Author

Kazuhito Takahashi(https://twitter.com/KzhtTkhs)

License

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