目录
写在前面
模型文件
导出命令
python预测
写在前面
前面两篇文章,我们分别介绍了Paddledetection训练模型的环境配置和模型训练过程:
使用Paddledetection进行模型训练【Part1:环境配置】 - CSDN
使用Paddledetection进行模型训练【Part2:数据准备+模型训练】 - CSDN
本节,我们继续来讲解如何导出模型并进行python预测。
模型文件
当我们模型训练完成后,就会得到如下3个文件。如图所示的是训练到40轮次时的模型。
如何进行模型导出呢?
导出命令
使用如下命令即可:
python tools/export_model.py -c configs/mask_rtdetr/mask_rtdetr_hgnetv2_x_6x_coco.yml --output_dir=./inference_model -o weights=model-finish/mask_rtdetr_hgnetv2_x_6x_coco/40.pdparams
导出后,就会看到如下文件:
python预测
使用如下命令进行模型预测:
python deploy/python/infer.py --model_dir=./inference_model/mask_rtdetr_hgnetv2_x_6x_coco --image_file=./demo/1.jpg --device=GPU
预测后就会得到如下结果图:
发布于 2025-01-08 11:32・IP 属地北京