PaddleDetection-PP-YOLOv2 模型

2021SC@SDUSC本周分析

PP-YOLO模型库 

Model GPU number images/GPU backbone input shape Box APval Box APtest V100 FP32(FPS) V100 TensorRT FP16(FPS) download config
PP-YOLO 8 24 ResNet50vd 608 44.8 45.2 72.9 155.6 model config
PP-YOLO 8 24 ResNet50vd 512 43.9 44.4 89.9 188.4 model config
PP-YOLO 8 24 ResNet50vd 416 42.1 42.5 109.1 215.4 model config
PP-YOLO 8 24 ResNet50vd 320 38.9 39.3 132.2 242.2 model config
PP-YOLO_2x 8 24 ResNet50vd 608 45.3 45.9 72.9 155.6 model config
PP-YOLO_2x 8 24 ResNet50vd 512 44.4 45.0 89.9 188.4 model config
PP-YOLO_2x 8 24 ResNet50vd 416 42.7 43.2 109.1 215.4 model config
PP-YOLO_2x 8 24 ResNet50vd 320 39.5 40.1 132.2 242.2 model config
PP-YOLO 4 32 ResNet18vd 512 29.2 29.5 357.1 657.9 model config
PP-YOLO 4 32 ResNet18vd 416 28.6 28.9 409.8 719.4 model config
PP-YOLO 4 32 ResNet18vd 320 26.2 26.4 480.7 763.4 model config
PP-YOLOv2 8 12 ResNet50vd 640 49.1 49.5 68.9 106.5 model config
PP-YOLOv2 8 12 ResNet101vd 640 49.7 50.3 49.5 87.0 model config

修改配置文件ppyolov2_r50vd_dcn_365e_coco.yml

_BASE_: [
  '../datasets/coco_detection.yml',
  '../runtime.yml',
  './_base_/ppyolov2_r50vd_dcn.yml',
  './_base_/optimizer_365e.yml',
  './_base_/ppyolov2_reader.yml',
]

修改配置文件PaddleDetection/configs/datasets/coco_detection.yml

metric: COCO
num_classes: 4  # 不包含背景类

TrainDataset:
  !COCODataSet
    image_dir: images
    anno_path: annotations/train.json
    dataset_dir: /home/aistudio/data
    data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']

EvalDataset:
  !COCODataSet
    image_dir: images
    anno_path: annotations/valid.json
    dataset_dir: /home/aistudio/data

TestDataset:
  !ImageFolder
    anno_path: /home/aistudio/data/annotations/valid.json

训练迭代了500epoch

使用单GPU通过如下命令一键式评估模型在COCO val2017数据集效果

# 使用PaddleDetection发布的权重
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams

# 使用训练保存的checkpoint
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/ppyolo/ppyolo.yml -o weights=output/ppyolo/best_model
# 使用PaddleDetection发布的权重
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/ppyolo/ppyolo_test.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams

# 使用训练保存的checkpoint
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/ppyolo/ppyolo_test.yml -o weights=output/ppyolo/best_model
# 推理单张图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439_640x640.jpg

# 推理目录下所有图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_dir=demo
# 推理单张图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439_640x640.jpg

# 推理目录下所有图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_dir=demo
# 推理单张图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439_640x640.jpg

# 推理目录下所有图像
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_dir=demo
# 导出模型,通过--exclude_nms参数裁剪掉模型中的NMS部分,默认存储于output/ppyolo目录
python tools/export_model.py -c configs/ppyolo/ppyolo.yml -o weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --exclude_nms

# FP32 benchmark测试
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output/ppyolo --image_file=demo/000000014439_640x640.jpg --use_gpu=True --run_benchmark=True

# TensorRT FP16 benchmark测试
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output/ppyolo --image_file=demo/000000014439_640x640.jpg --use_gpu=True --run_benchmark=True --run_mode=trt_fp16

你可能感兴趣的:(笔记,深度学习,计算机视觉,pytorch)