一个关于使用VOC数据集来训练ssdlite_mobilenetV3_small的问题,哪位大佬能帮忙分析,非常急切!
训练的命令为:python tools/train.py/ssd/ssdlite_mobilenet_v3_small.yml --eval 问题截图如下:
我这里 初步估计是配置文件没有写好。配置文件如下:
我这里复制一下配置文件,方便查看:
architecture: SSD
use_gpu: true
max_iters: 5000
snapshot_iter: 20000
log_iter: 20
metric: COCO
pretrain_weights: pretrainWeights/MobileNetV3_small_x1_0_ssld_pretrained
save_dir: output
weights: output/ssd_mobilenet_v3_small/model_final
# 80(label_class) + 1(background)
num_classes: 21
SSD:
backbone: MobileNetV3
multi_box_head: SSDLiteMultiBoxHead
output_decoder:
background_label: 0
keep_top_k: 200
nms_eta: 1.0
nms_threshold: 0.45
nms_top_k: 400
score_threshold: 0.01
MobileNetV3:
scale: 1.0
model_name: small
extra_block_filters: [[256, 512], [128, 256], [128, 256], [64, 128]]
feature_maps: [5, 7, 8, 9, 10, 11]
lr_mult_list: [0.25, 0.25, 0.5, 0.5, 0.75]
conv_decay: 0.00004
multiplier: 0.5
SSDLiteMultiBoxHead:
aspect_ratios: [[2.], [2., 3.], [2., 3.], [2., 3.], [2., 3.], [2., 3.]]
base_size: 320
steps: [16, 32, 64, 107, 160, 320]
flip: true
clip: true
max_ratio: 95
min_ratio: 20
offset: 0.5
conv_decay: 0.00004
LearningRate:
base_lr: 0.4
schedulers:
- !CosineDecay
max_iters: 400000
- !LinearWarmup
start_factor: 0.33333
steps: 2000
OptimizerBuilder:
optimizer:
momentum: 0.9
type: Momentum
regularizer:
factor: 0.0005
type: L2
TrainReader:
inputs_def:
image_shape: [3, 320, 320]
fields: ['image', 'gt_bbox', 'gt_class']
dataset:
!VOCDataSet
dataset_dir: dataset/voc
anno_path: trainval.txt
sample_transforms:
- !DecodeImage
to_rgb: true
- !RandomDistort
brightness_lower: 0.875
brightness_upper: 1.125
is_order: true
- !RandomExpand
fill_value: [123.675, 116.28, 103.53]
- !RandomCrop
allow_no_crop: false
- !NormalizeBox {}
- !ResizeImage
interp: 1
target_size: 320
use_cv2: false
- !RandomFlipImage
is_normalized: false
- !NormalizeImage
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
is_scale: true
is_channel_first: false
- !Permute
to_bgr: false
channel_first: true
batch_size: 32
shuffle: true
drop_last: true
# Number of working threads/processes. To speed up, can be set to 16 or 32 etc.
worker_num: 8
# Size of shared memory used in result queue. After increasing `worker_num`, need expand `memsize`.
memsize: 8G
# Buffer size for multi threads/processes.one instance in buffer is one batch data.
# To speed up, can be set to 64 or 128 etc.
bufsize: 32
use_process: true
EvalReader:
inputs_def:
image_shape: [3, 320, 320]
fields: ['image', 'gt_bbox', 'gt_class', 'im_shape', 'im_id']
dataset:
!VOCDataSet
dataset_dir: dataset/voc
anno_path: test.txt
sample_transforms:
- !DecodeImage
to_rgb: true
- !NormalizeBox {}
- !ResizeImage
interp: 1
target_size: 320
use_cv2: false
- !NormalizeImage
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
is_scale: true
is_channel_first: false
- !Permute
to_bgr: false
channel_first: True
batch_size: 8
worker_num: 8
bufsize: 32
use_process: false
TestReader:
inputs_def:
image_shape: [3,320,320]
fields: ['image', 'im_id', 'im_shape']
dataset:
!ImageFolder
anno_path: annotations/instances_val2017.json
sample_transforms:
- !DecodeImage
to_rgb: true
- !ResizeImage
interp: 1
max_size: 0
target_size: 320
use_cv2: true
- !NormalizeImage
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
is_scale: true
is_channel_first: false
- !Permute
to_bgr: false
channel_first: True
batch_size: 1
我对配置文件的修改就是: dataset: VOCDateSet; 以及相应的数据集的的路径,然后开头的 num_classes改为 21。 其他均不变。
我对配置文件的修改就是: dataset: VOCDateSet; 以及相应的数据集的的路径,然后开头的 num_classes改为 21。 其他均不变。
我对配置文件的修改就是: dataset: VOCDateSet; 以及相应的数据集的的路径,然后开头的 num_classes改为 21。 其他均不变。
metric应为VOC,不是COCO了,不然在评估时会加载coco数据的json文件
architecture: SSD
use_gpu: true
max_iters: 5000
snapshot_iter: 20000
log_iter: 20
metric: VOC
这样吗,因为我觉得VOC数据也可以采用coco数据集的评估方式,所以就没有改。非常感谢您的解答,我重新运行一下。
按照您的帮助,我把metric改为了VOC,但好像配置文件还是存在问题。
其余的和上面写的配置文件一致,除了将评估方式改为了VOC
根据上面信息,可能是数据路径问题,建议您: (1)先用官方配置文件 静态图:https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.0-rc/configs/ssd/ssd_mobilenet_v1_voc.yml 动态图:https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.0-rc/dygraph/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml。 (2)然后再排查问题。 (3)注意paddle版本:https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.0-rc/docs/tutorials/INSTALL_cn.md
Since this issue has not been updated for more than three months, it will be closed, if it is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于该问题超过三个月未更新,将会被关闭,若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。