Skip to content

使用 detrex 框架

训练epoch

detrex 使用 detection2 中对训练的定义,在detection2 没有epoch 的概念,只有training iterations 训练迭代次数的概念,detrex 使用 max_iter 定义迭代从次数如果一个批量大小为2那么经过一个批量,就算 迭代一次 推算eopch ,如果数据集有20,000 张,那么max_iter=len(train_dataset)/batch_size=10000 就算是训练一个 epoch

max_iter=len(train_dataset)/batch_size*epoch

# batch_size=total_batch_size/gpu_nums

数据集

通过环境变量,自定义数据集路径

import os
os.environ['DETECTRON2_DATASETS'] = '/home/ubuntu/datasets'
# ... other codes

安装

conda create -n detrex python=3.8 -y
# 请检查detrex 官方库使用的版本