测试
python tools/test.py <your-config-file> <your-model-weights-file> --out <save-pickle-path>
关于test.py 的命令行
parser.add_argument(
'--out',
type=str,
help='dump predictions to a pickle file for offline evaluation')
计算量、参数量计算脚本
python tools/analysis_tools/get_flops.py <你的配置文件位置>
结果图
==============================
Use size divisor set input shape from (1080, 1920) to (768, 1344)
==============================
Compute type: dataloader: load a picture from the dataset
Input shape: (768, 1344)
Flops: 0.199T
Params: 32.039M
推理时间、fps、gpu memory,计算脚本
需要下面的依赖
pip install psutil --upgrade
python tools/analysis_tools/benchmark.py <你的配置文件位置> --checkpoint <模型权重epoth> --task inference --fuse-conv-bn
结果图
04/29 17:04:51 - mmengine - INFO - ============== Done ==================
04/29 17:04:51 - mmengine - INFO - Overall fps: 34.1 img/s, times per image: 29.3 ms/img
04/29 17:04:51 - mmengine - INFO - cuda memory: 365 MB
04/29 17:04:51 - mmengine - INFO - (GB) mem_used: 13.95 | uss: 5.80 | pss: 5.80 | total_proc: 1
绘制曲线图脚本
python tools/analysis_tools/analyze_logs.py plot_curve <train-json-file> --keys <关键词:loss> --legend <标题> --out <保存为pdf形式>
示例
python tools/analysis_tools/analyze_logs.py plot_curve work_dirs/tood_r50_1x_visdrone/20240429_141736/vis_data/20240429_141736.json --keys loss_cls loss --legend loss_cls loss --out work_dirs/losses_1.pdf
多卡训练
bash ./tools/dist_train.sh \
${CONFIG_FILE} \
${GPU_NUM} \
[optional arguments]
详情参考官方文档
https://mmdetection.readthedocs.io/zh-cn/latest/user_guides/useful_tools.html#id2