[Japanese/English]
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
- 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
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
Training will be conducted on Google Colaboratory.
Open your notebook from the [Open In Colab] link and run it in the following order:
- YOLOX 依存パッケージインストール(YOLOX Dependent Package Install)
- NVIDIA APEXインストール(NVIDIA APEX Install)
- PyCocoToolsインストール(PyCocoTools Install)
- データセットダウンロード(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". - Pascal VOC形式 を MS COCO形式へ変換(Convert Pascal VOC format to MS COCO format)
- モデル訓練(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".- Number of classes
self.num_classes - Image storage path
self.data_dir - Training data annotation file
self.train_ann - Validation data annotation file
self.val_ann - Number of epochs
self.max_epoch
- Number of classes
- 推論テスト(Inference test)
- ONNX変換(Convert to ONNX)
※The original file of "nano.py" is stored in "Megvii-BaseDetection/YOLOX/exps/default"
Kazuhito Takahashi(https://twitter.com/KzhtTkhs)
YOLOX-Colaboratory-Training-Sample is under Apache-2.0 License.