持续创作,加速成长!这是我参与「掘金日新计划 · 6 月更文挑战」的第3天,点击查看活动详情
一、基于PP-PicoDet的【车辆检测系统】
地址: aistudio.baidu.com/aistudio/pr…
1.模型训练
可看1-6节。
车辆检测使我们工业中经常遇到的,现使用1.3GB的 VOC中车辆数据进行训练,下面简单看看过程。
为提升效果,可 多轮训练,目标检测训练时长大,要有心理准备。
2.模型演示
模型演示可直接看第七节。
二、数据处理
1.解压缩数据
# 解压缩数据
# 解压到data目录,避免解压到其他持久化目录后,启动速度慢
!unzip -qoa data/data55670/VOCData.zip -d data/
2.按比例划分数据集
ratio比例系数
%cd ~
import random
import os
#生成train.txt和val.txt
xml_dir = 'data/VOCData/Annotations'#标签文件地址
img_dir = 'data/VOCData/JPEGImages'#图像文件地址
path_list = list()
for img in os.listdir(img_dir):
img_path = os.path.join(img_dir,img)
xml_path = os.path.join(xml_dir,img.replace('jpg', 'xml'))
path_list.append((img_path, xml_path))
random.shuffle(path_list)
# 9:1
ratio = 0.9
train_f = open('data/VOCData/train.txt','w') #生成训练文件
val_f = open('data/VOCData/val.txt' ,'w')#生成验证文件
for i ,content in enumerate(path_list):
img, xml = content
text = img + ' ' + xml + '\n'
if i < len(path_list) * ratio:
train_f.write(text)
else:
val_f.write(text)
train_f.close()
val_f.close()
#生成标签文档
label = ['car', 'van', 'bus', 'others']#设置你想检测的类别
with open('data/VOCData/label_list.txt', 'w') as f:
for text in label:
f.write(text+'\n')
/home/aistudio
!head data/VOCData/label_list.txt
car
van
bus
others
!head data/VOCData/val.txt
data/VOCData/JPEGImages/MVI_63554__img00141.jpg data/VOCData/Annotations/MVI_63554__img00141.xml data/VOCData/JPEGImages/MVI_40213__img01591.jpg data/VOCData/Annotations/MVI_40213__img01591.xml data/VOCData/JPEGImages/MVI_40732__img01059.jpg data/VOCData/Annotations/MVI_40732__img01059.xml data/VOCData/JPEGImages/MVI_63554__img01297.jpg data/VOCData/Annotations/MVI_63554__img01297.xml data/VOCData/JPEGImages/MVI_39801__img00822.jpg data/VOCData/Annotations/MVI_39801__img00822.xml
data/VOCData/JPEGImages/MVI_40201__img00678.jpg data/VOCData/Annotations/MVI_40201__img00678.xml data/VOCData/JPEGImages/MVI_40752__img01122.jpg data/VOCData/Annotations/MVI_40752__img01122.xml data/VOCData/JPEGImages/MVI_41063__img00094.jpg data/VOCData/Annotations/MVI_41063__img00094.xml data/VOCData/JPEGImages/MVI_63562__img00571.jpg data/VOCData/Annotations/MVI_63562__img00571.xml data/VOCData/JPEGImages/MVI_63554__img00697.jpg data/VOCData/Annotations/MVI_63554__img00697.xml
3.数据查看
源数据格式为VOC格式,存储格式如下:
dataset/
├── Annotations
│ ├── xxx1.xml
│ ├── xxx2.xml
│ ├── xxx3.xml
│ | ...
├── Images
│ ├── xxx1.jpg
│ ├── xxx2.jpg
│ ├── xxx3.jpg
│ | ...
├── label_list.txt (必须提供)
├── train.txt (训练数据集文件列表, ./Images/xxx1.jpg ./Annotations/xxx1.xml)
├── valid.txt (测试数据集文件列表)
三、环境准备
1.PP-PicoDet介绍
PaddleDetection中提出了全新的轻量级系列模型PP-PicoDet
,在移动端具有卓越的性能,成为全新SOTA轻量级模型。详细的技术细节可以参考我们的arXiv技术报告。
PP-PicoDet模型有如下特点:
- 🌟 更高的mAP: 第一个在1M参数量之内
mAP(0.5:0.95)
超越30+(输入416像素时)。 - 🚀 更快的预测速度: 网络预测在ARM CPU下可达150FPS。
- 😊 部署友好: 支持PaddleLite/MNN/NCNN/OpenVINO等预测库,支持转出ONNX,提供了C++/Python/Android的demo。
- 😍 先进的算法: 我们在现有SOTA算法中进行了创新, 包括:ESNet, CSP-PAN, SimOTA等等。目前
2.数据格式
目前PP-PicoDet支持 VOC 和 COCO 两种格式,可根据需要选择。
3.基线
模型 | 输入尺寸 | mAPval 0.5:0.95 |
mAPval 0.5 |
参数量 (M) |
FLOPS (G) |
预测时延NCNN (ms) |
预测时延Lite (ms) |
下载 | 配置文件 |
---|---|---|---|---|---|---|---|---|---|
PicoDet-S | 320*320 | 27.1 | 41.4 | 0.99 | 0.73 | 8.13 | 6.65 | model | log | config |
PicoDet-S | 416*416 | 30.7 | 45.8 | 0.99 | 1.24 | 12.37 | 9.82 | model | log | config |
PicoDet-M | 320*320 | 30.9 | 45.7 | 2.15 | 1.48 | 11.27 | 9.61 | model | log | config |
PicoDet-M | 416*416 | 34.8 | 50.5 | 2.15 | 2.50 | 17.39 | 15.88 | model | log | config |
PicoDet-L | 320*320 | 32.9 | 48.2 | 3.30 | 2.23 | 15.26 | 13.42 | model | log | config |
PicoDet-L | 416*416 | 36.6 | 52.5 | 3.30 | 3.76 | 23.36 | 21.85 | model | log | config |
PicoDet-L | 640*640 | 40.9 | 57.6 | 3.30 | 8.91 | 54.11 | 50.55 | model | log | config |
更多的配置
模型 | 输入尺寸 | mAPval 0.5:0.95 |
mAPval 0.5 |
参数量 (M) |
FLOPS (G) |
预测时延NCNN (ms) |
预测时延Lite (ms) |
下载 | 配置文件 |
---|---|---|---|---|---|---|---|---|---|
PicoDet-Shufflenetv2 1x | 416*416 | 30.0 | 44.6 | 1.17 | 1.53 | 15.06 | 10.63 | model | log | config |
PicoDet-MobileNetv3-large 1x | 416*416 | 35.6 | 52.0 | 3.55 | 2.80 | 20.71 | 17.88 | model | log | config |
PicoDet-LCNet 1.5x | 416*416 | 36.3 | 52.2 | 3.10 | 3.85 | 21.29 | 20.8 | model | log | config |
PicoDet-LCNet 1.5x | 640*640 | 40.6 | 57.4 | 3.10 | – | – | – | model | log | config |
PicoDet-R18 | 640*640 | 40.7 | 57.2 | 11.10 | – | – | – | model | log | config |
注意事项:
- 时延测试: 我们所有的模型都在
骁龙865(4xA77+4xA55)
上测试(4线程,FP16预测)。上面表格中标有NCNN
的是使用NCNN库测试,标有Lite
的是使用Paddle Lite进行测试。 测试的benchmark脚本来自: MobileDetBenchmark。 - PicoDet在COCO train2017上训练,并且在COCO val2017上进行验证。
- PicoDet使用4卡GPU训练(PicoDet-L-640使用8卡训练),并且所有的模型都是通过发布的默认配置训练得到。
其他模型的基线
模型 | 输入尺寸 | mAPval 0.5:0.95 |
mAPval 0.5 |
参数量 (M) |
FLOPS (G) |
预测时延NCNN (ms) |
---|---|---|---|---|---|---|
YOLOv3-Tiny | 416*416 | 16.6 | 33.1 | 8.86 | 5.62 | 25.42 |
YOLOv4-Tiny | 416*416 | 21.7 | 40.2 | 6.06 | 6.96 | 23.69 |
PP-YOLO-Tiny | 320*320 | 20.6 | – | 1.08 | 0.58 | 6.75 |
PP-YOLO-Tiny | 416*416 | 22.7 | – | 1.08 | 1.02 | 10.48 |
Nanodet-M | 320*320 | 20.6 | – | 0.95 | 0.72 | 8.71 |
Nanodet-M | 416*416 | 23.5 | – | 0.95 | 1.2 | 13.35 |
Nanodet-M 1.5x | 416*416 | 26.8 | – | 2.08 | 2.42 | 15.83 |
YOLOX-Nano | 416*416 | 25.8 | – | 0.91 | 1.08 | 19.23 |
YOLOX-Tiny | 416*416 | 32.8 | – | 5.06 | 6.45 | 32.77 |
YOLOv5n | 640*640 | 28.4 | 46.0 | 1.9 | 4.5 | 40.35 |
YOLOv5s | 640*640 | 37.2 | 56.0 | 7.2 | 16.5 | 78.05 |
4.安装
环境要求
- PaddlePaddle >= 2.1.2
- Python >= 3.5
- PaddleSlim >= 2.1.1
- PaddleLite >= 2.10
# 下载PaddleDetection源码,执行如下命令
!git clone https://gitee.com/PaddlePaddle/PaddleDetection.git -b develop --depth 1
# 安装其他依赖
%cd ~/PaddleDetection
!pip install -U pip --user
!pip install -r requirements.txt
# 编译安装paddledet
!python setup.py install
!pip install paddleslim==2.1.1
四、执行训练
1.模型选择
因为要部署在移动端,且保证速度快和精度高,因此我们选择PaddleDetection提出的全新轻量级系列模型PP-PicoDet,模型有如下特点:
- 更高的mAP: 第一个在1M参数量之内mAP(0.5:0.95)超越30+(输入416像素时)。
- 更快的预测速度: 网络预测在ARM CPU下可达150FPS。
- 部署友好: 支持PaddleLite/MNN/NCNN/OpenVINO等预测库,支持转出ONNX,提供了C++/Python/Android的demo。
- 先进的算法: 我们在现有SOTA算法中进行了创新, 包括:ESNet, CSP-PAN, SimOTA等等。
在此选择PP-PicoDet的VOC数据集训练配置
2.数据集配置修改
(1)首先修改configs/datasets/voc.yml
metric: VOC
map_type: 11point
num_classes: 4
TrainDataset:
!VOCDataSet
dataset_dir: /home/aistudio/
anno_path: /home/aistudio/data/VOCData/train.txt
label_list: /home/aistudio/data/VOCData/label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
EvalDataset:
!VOCDataSet
dataset_dir: /home/aistudio/
anno_path: /home/aistudio/data/VOCData/val.txt
label_list: /home/aistudio/data/VOCData/label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
TestDataset:
!ImageFolder
anno_path: /home/aistudio/data/VOCData/label_list.txt
数据集包含的类别数:num_classes 包含训练集、验证集、测试集的图片路径image_dir、标注json文件路径anno_path、数据集路径dataset_dir
(2)然后修改 configs/picodet/picodet_s_320_voc.yml
预训练模型:pretrain_weights
训练超参数:epoch、batch_size、base_lr
# 已配置好,覆盖
%cd ~
!cp voc.yml ~/PaddleDetection/configs/datasets/voc.yml
/home/aistudio
3.batchsize配置修改
计算如下图,一目了然
即256的batch size 对应显存16Gb,那么接近32的就是32*256/16=256,为了防止爆内存,稍微小一点,取个200也是不错的选择,下面就是修改了。
PaddleDetection/configs/picodet/legacy_model/base/picodet_320_reader.yml
worker_num: 6
eval_height: &eval_height 320
eval_width: &eval_width 320
eval_size: &eval_size [*eval_height, *eval_width]
TrainReader:
sample_transforms:
- Decode: {}
- RandomCrop: {}
- RandomFlip: {prob: 0.5}
- RandomDistort: {}
batch_transforms:
- BatchRandomResize: {target_size: [256, 288, 320, 352, 384], random_size: True, random_interp: True, keep_ratio: False}
- NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
- Permute: {}
#此处修改batch size
batch_size: 200
shuffle: true
drop_last: true
collate_batch: false
EvalReader:
sample_transforms:
- Decode: {}
- Resize: {interp: 2, target_size: *eval_size, keep_ratio: False}
- NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
- Permute: {}
batch_transforms:
- PadBatch: {pad_to_stride: 32}
#此处修改batch size
batch_size: 64
shuffle: false
TestReader:
inputs_def:
image_shape: [1, 3, *eval_height, *eval_width]
sample_transforms:
- Decode: {}
- Resize: {interp: 2, target_size: *eval_size, keep_ratio: False}
- NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
- Permute: {}
batch_size: 1
%cd ~
!cp ~/picodet_320_reader.yml PaddleDetection/configs/picodet/legacy_model/_base_/picodet_320_reader.yml
/home/aistudio
4.模型训练
PaddleDetection提供了单卡/多卡训练模型,满足用户多种训练需求,具体代码如下:
# 单卡GPU上训练
%cd ~/PaddleDetection/
!export CUDA_VISIBLE_DEVICES=0 #windows和Mac下不需要执行该命令
!python tools/train.py -c ./configs/picodet/legacy_model/picodet_s_320_voc.yml --eval
日志
[05/12 02:23:48] ppdet.engine INFO: Epoch: [9] [20/76] learning_rate: 0.399682 loss_vfl: 0.597211 loss_bbox: 0.319927 loss_dfl: 0.168239 loss: 1.097577 eta: 1 day, 5:06:06 batch_cost: 4.3475 data_cost: 0.0042 ips: 55.2044 images/s
[05/12 02:25:15] ppdet.engine INFO: Epoch: [9] [40/76] learning_rate: 0.399650 loss_vfl: 0.598503 loss_bbox: 0.326233 loss_dfl: 0.169692 loss: 1.099552 eta: 1 day, 4:59:44 batch_cost: 4.2694 data_cost: 0.0047 ips: 56.2139 images/s
[05/12 02:26:42] ppdet.engine INFO: Epoch: [9] [60/76] learning_rate: 0.399616 loss_vfl: 0.586542 loss_bbox: 0.313494 loss_dfl: 0.167617 loss: 1.065311 eta: 1 day, 4:53:30 batch_cost: 4.2559 data_cost: 0.0043 ips: 56.3921 images/s
[05/12 02:27:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_s_320_voc
[05/12 02:27:54] ppdet.engine INFO: Eval iter: 0
[05/12 02:28:49] ppdet.metrics.metrics INFO: Accumulating evaluatation results...
[05/12 02:28:51] ppdet.metrics.metrics INFO: mAP(0.50, 11point) = 69.32%
[05/12 02:28:51] ppdet.engine INFO: Total sample number: 2052, averge FPS: 30.916045137083792
[05/12 02:28:51] ppdet.engine INFO: Best test bbox ap is 0.693.
[05/12 02:28:51] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_s_320_voc
五、模型评估
# 解压缩训练好的模型
%cd ~
!unzip data/data146400/best_model.zip -d data
/home/aistudio
Archive: data/data146400/best_model.zip
inflating: data/best_model.pdema
inflating: data/best_model.pdopt
inflating: data/best_model.pdparams
%cd ~/PaddleDetection/
!python -u tools/eval.py -c ./configs/picodet/legacy_model/picodet_s_320_voc.yml -o weights=../data/best_model.pdparams
/home/aistudio/PaddleDetection
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:130: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
W0514 13:16:47.233289 888 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0514 13:16:47.239045 888 device_context.cc:465] device: 0, cuDNN Version: 7.6.
[05/14 13:16:52] ppdet.utils.checkpoint INFO: Finish loading model weights: ../data/best_model.pdparams
[05/14 13:16:57] ppdet.engine INFO: Eval iter: 0
[05/14 13:17:17] ppdet.metrics.metrics INFO: Accumulating evaluatation results...
[05/14 13:17:18] ppdet.metrics.metrics INFO: mAP(0.50, 11point) = 92.90%
[05/14 13:17:18] ppdet.engine INFO: Total sample number: 2052, averge FPS: 82.36801973453392
六、模型预测
1.动态图预测
在执行tools/infer.py后,在output文件夹下会生成对应的预测结果
%cd ~/PaddleDetection
!python tools/infer.py -c ./configs/picodet/legacy_model/picodet_s_320_voc.yml -o weights=../data/best_model.pdparams --infer_img=/home/aistudio/data/VOCData/JPEGImages/MVI_63563__img01358.jpg
/home/aistudio/PaddleDetection
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:130: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
W0514 13:19:47.305101 1498 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0514 13:19:47.310273 1498 device_context.cc:465] device: 0, cuDNN Version: 7.6.
[05/14 13:19:50] ppdet.utils.checkpoint INFO: Finish loading model weights: ../data/best_model.pdparams
100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 4.50it/s]
[05/14 13:19:51] ppdet.engine INFO: Detection bbox results save in output/MVI_63563__img01358.jpg
2. 结果展示
原图
预测图
3.模型导出
在模型训练过程中保存的模型文件是包含前向预测和反向传播的过程,在实际的工业部署则不需要反向传播,因此需要将模型进行导成部署需要的模型格式。 执行下面命令,即可导出模型
!export CUDA_VISIBLE_DEVICES=0
%cd ~/PaddleDetection/
!python tools/export_model.py \
-c ./configs/picodet/legacy_model/picodet_s_320_voc.yml \
-o weights=../data/best_model.pdparams \
--output_dir=inference_model
/home/aistudio/PaddleDetection
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:130: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
[05/14 13:21:00] ppdet.utils.checkpoint INFO: Finish loading model weights: ../data/best_model.pdparams
[05/14 13:21:00] ppdet.engine INFO: Export inference config file to inference_model/picodet_s_320_voc/infer_cfg.yml
W0514 13:21:06.413223 1646 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0514 13:21:06.413300 1646 device_context.cc:465] device: 0, cuDNN Version: 7.6.
[05/14 13:21:10] ppdet.engine INFO: Export model and saved in inference_model/picodet_s_320_voc
!tree ./inference_model/picodet_s_320_voc
./inference_model/picodet_s_320_voc
├── infer_cfg.yml
├── model.pdiparams
├── model.pdiparams.info
└── model.pdmodel
0 directories, 4 files
预测模型会导出到inference_model/目录下,包括model.pdmodel、model.pdiparams、model.pdiparams.info和infer_cfg.yml四个文件,分别表示模型的网络结构、模型权重、模型权重名称和模型的配置文件(包括数据预处理参数等)的流程配置文件。
4.静态图预测
在终端输入以下命令进行预测,详细教程请参考Python端预测部署:
!export CUDA_VISIBLE_DEVICES=0
''' --model_dir: 上述导出的模型路径 --image_file:需要测试的图片 --image_dir:也可以指定要测试的文件夹路径 --device:运行时的设备,可选择CPU/GPU/XPU,默认为CPU --output_dir:可视化结果保存的根目录,默认为output/ '''
!python deploy/python/infer.py \
--model_dir=./inference_model/picodet_s_320_voc \
--image_file=/home/aistudio/data/VOCData/JPEGImages/MVI_63562__img01131.jpg \
--device=GPU
----------- Running Arguments -----------
action_file: None
batch_size: 1
camera_id: -1
cpu_threads: 1
device: GPU
enable_mkldnn: False
enable_mkldnn_bfloat16: False
image_dir: None
image_file: /home/aistudio/data/VOCData/JPEGImages/MVI_63562__img01131.jpg
model_dir: ./inference_model/picodet_s_320_voc
output_dir: output
random_pad: False
reid_batch_size: 50
reid_model_dir: None
run_benchmark: False
run_mode: paddle
save_images: False
save_mot_txt_per_img: False
save_mot_txts: False
scaled: False
threshold: 0.5
tracker_config: None
trt_calib_mode: False
trt_max_shape: 1280
trt_min_shape: 1
trt_opt_shape: 640
use_dark: True
use_gpu: False
video_file: None
window_size: 50
------------------------------------------
----------- Model Configuration -----------
Model Arch: GFL
Transform Order:
--transform op: Resize
--transform op: NormalizeImage
--transform op: Permute
--------------------------------------------
class_id:0, confidence:0.9383, left_top:[336.46,323.37],right_bottom:[595.58,474.24]
class_id:0, confidence:0.9258, left_top:[757.87,140.97],right_bottom:[860.73,196.62]
class_id:0, confidence:0.9188, left_top:[368.29,131.18],right_bottom:[483.35,191.45]
class_id:0, confidence:0.8765, left_top:[502.53,128.79],right_bottom:[624.57,185.79]
class_id:0, confidence:0.8606, left_top:[746.50,40.06],right_bottom:[794.67,67.57]
class_id:0, confidence:0.7781, left_top:[1.76,403.54],right_bottom:[146.61,508.57]
class_id:2, confidence:0.9383, left_top:[494.02,56.53],right_bottom:[630.39,133.80]
save result to: output/MVI_63562__img01131.jpg
Test iter 0
------------------ Inference Time Info ----------------------
total_time(ms): 2927.7000000000003, img_num: 1
average latency time(ms): 2927.70, QPS: 0.341565
preprocess_time(ms): 2910.30, inference_time(ms): 17.30, postprocess_time(ms): 0.10
4K的图片,推理速耗时 0.10ms ,速度相当不错。
原图:
预测图:
七、快速体验
快读体验需要如下工作:
- 1.下载PaddleDetection,即,执行第三节内容。
- 2.预测,即下面内容。
- 3.预测图片可以自己找图上传,需注意修改infer_img路径
1.使用训练好的模型
参看第五节,解压缩训练好的模型进行预测。
2.使用预训练模型
# 解压缩训练好的模型
%cd ~
!unzip data/data146400/best_model.zip -d data
/home/aistudio
Archive: data/data146400/best_model.zip
inflating: data/best_model.pdema
inflating: data/best_model.pdopt
inflating: data/best_model.pdparams
# 用PP-YOLO算法在COCO数据集上预训练模型预测一张图片
# 预测图片可以替换为自己喜欢的图
%cd ~/PaddleDetection/
!python tools/infer.py -c ./configs/picodet/picodet_l_640_coco_lcnet.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/picodet_l_640_coco_lcnet.pdparams --infer_img=../car1.jpg
/home/aistudio/PaddleDetection
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:130: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
W0512 12:48:14.749495 828 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0512 12:48:14.766312 828 device_context.cc:465] device: 0, cuDNN Version: 7.6.
[05/12 12:48:20] ppdet.utils.download INFO: Downloading picodet_l_640_coco_lcnet.pdparams from https://paddledet.bj.bcebos.com/models/picodet_l_640_coco_lcnet.pdparams
100%|██████████████████████████████████| 22906/22906 [00:00<00:00, 28159.31KB/s]
[05/12 12:48:21] ppdet.utils.checkpoint INFO: Finish loading model weights: /home/aistudio/.cache/paddle/weights/picodet_l_640_coco_lcnet.pdparams
[05/12 12:48:21] ppdet.data.source.category WARNING: anno_file 'dataset/coco/annotations/instances_val2017.json' is None or not set or not exist, please recheck TrainDataset/EvalDataset/TestDataset.anno_path, otherwise the default categories will be used by metric_type.
[05/12 12:48:21] ppdet.data.source.category WARNING: metric_type: COCO, load default categories of COCO.
100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 1.81it/s]
[05/12 12:48:22] ppdet.engine INFO: Detection bbox results save in output/car1.jpg
原图
预测图
预测图位于:PaddleDetection/output/car1.jpg,可在线打开。
八、后台任务运行
目标检测任务运行时间久,长久开网页挂notebook并非明智之举,那么可以使用后台任务来进行。
1.具体步骤如下
- 1.写好notebook
- 2.炎症性运行
- 3.生成版本提交后台运行
- 4.睡一觉起来下载运行结果
2.运行期间日志查看
3.运行完毕系统消息提醒
4.下载输出
今天的文章基于PP-PicoDet的【车辆检测系统】分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/17955.html