未验证 提交 31ce8917 编写于 作者: G Guanghua Yu 提交者: GitHub

add outstanding pcb config (#1523)

上级 8072895c
# 印刷电路板(PCB)瑕疵数据集模型
- 印刷电路板(PCB)瑕疵数据集:[数据下载链接](http://robotics.pkusz.edu.cn/resources/dataset/),是一个公共的合成PCB数据集,由北京大学发布,其中包含1386张图像以及6种缺陷(缺失孔,鼠标咬伤,开路,短路,杂散,伪铜),用于检测,分类和配准任务。我们选取了其中适用与检测任务的693张图像,随机选择593张图像作为训练集,100张图像作为验证集。AIStudio数据集链接:[印刷电路板(PCB)瑕疵数据集](https://aistudio.baidu.com/aistudio/datasetdetail/52914)
## 已提供的基线模型
- YOLOv3-Darknet
- Faster-RCNN-R34
- FCOS-R50-FPN
## 优化后高mAP模型
将在9月29日发布,敬请期待。
## 模型
| 模型 | mAP(Iou=0.50:0.95) | mAP(Iou=0.50) | 配置文件 |
| :-------: | :-------: | :----: | :-----: |
| Faster-RCNN-R50_vd_FPN_3x | 52.7 | 97.7 | faster_rcnn_r50_vd_fpn_3x.yml |
| YOLOv3_darknet | 44.8 | 94.6 | yolov3_darknet.yml |
| FCOS_R50_FPN_multiscale_3x | 54.9 | 98.5 | fcos_r50_fpn_multiscale_3x.yml |
architecture: FasterRCNN
max_iters: 3558
use_gpu: true
snapshot_iter: 1000
log_smooth_window: 20
save_dir: output
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet34_pretrained.tar
metric: COCO
weights: output/faster_rcnn_r34_fpn_1x/model_final
num_classes: 7
FasterRCNN:
backbone: ResNet
fpn: FPN
rpn_head: FPNRPNHead
roi_extractor: FPNRoIAlign
bbox_head: BBoxHead
bbox_assigner: BBoxAssigner
ResNet:
norm_type: bn
norm_decay: 0.
depth: 34
feature_maps: [2, 3, 4, 5]
freeze_at: 2
FPN:
min_level: 2
max_level: 6
num_chan: 256
spatial_scale: [0.03125, 0.0625, 0.125, 0.25]
FPNRPNHead:
anchor_generator:
anchor_sizes: [32, 64, 128, 256, 512]
aspect_ratios: [0.5, 1.0, 2.0]
stride: [16.0, 16.0]
variance: [1.0, 1.0, 1.0, 1.0]
anchor_start_size: 32
min_level: 2
max_level: 6
num_chan: 256
rpn_target_assign:
rpn_batch_size_per_im: 256
rpn_fg_fraction: 0.5
rpn_positive_overlap: 0.7
rpn_negative_overlap: 0.3
rpn_straddle_thresh: 0.0
train_proposal:
min_size: 0.0
nms_thresh: 0.7
pre_nms_top_n: 2000
post_nms_top_n: 2000
test_proposal:
min_size: 0.0
nms_thresh: 0.7
pre_nms_top_n: 1000
post_nms_top_n: 1000
FPNRoIAlign:
canconical_level: 4
canonical_size: 224
min_level: 2
max_level: 5
box_resolution: 7
sampling_ratio: 2
BBoxAssigner:
batch_size_per_im: 512
bbox_reg_weights: [0.1, 0.1, 0.2, 0.2]
bg_thresh_lo: 0.0
bg_thresh_hi: 0.5
fg_fraction: 0.25
fg_thresh: 0.5
BBoxHead:
head: TwoFCHead
nms:
keep_top_k: 100
nms_threshold: 0.5
score_threshold: 0.05
TwoFCHead:
mlp_dim: 1024
LearningRate:
base_lr: 0.0025
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [2372, 3261]
- !LinearWarmup
start_factor: 0.1
steps: 500
OptimizerBuilder:
optimizer:
momentum: 0.9
type: Momentum
regularizer:
factor: 0.0001
type: L2
_READER_: 'faster_fpn_reader.yml'
TrainReader:
batch_size: 2
architecture: FasterRCNN
max_iters: 11000
snapshot_iter: 1000
use_gpu: true
log_smooth_window: 20
save_dir: output
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar
weights: output/faster_rcnn_r50_vd_fpn_2x/model_final
metric: COCO
num_classes: 7
FasterRCNN:
backbone: ResNet
fpn: FPN
rpn_head: FPNRPNHead
roi_extractor: FPNRoIAlign
bbox_head: BBoxHead
bbox_assigner: BBoxAssigner
ResNet:
depth: 50
feature_maps: [2, 3, 4, 5]
freeze_at: 2
norm_type: bn
variant: d
FPN:
max_level: 6
min_level: 2
num_chan: 256
spatial_scale: [0.03125, 0.0625, 0.125, 0.25]
FPNRPNHead:
anchor_generator:
anchor_sizes: [8, 16, 32, 64, 128]
aspect_ratios: [0.5, 1.0, 2.0]
stride: [16.0, 16.0]
variance: [1.0, 1.0, 1.0, 1.0]
anchor_start_size: 8
max_level: 6
min_level: 2
num_chan: 256
rpn_target_assign:
rpn_batch_size_per_im: 256
rpn_fg_fraction: 0.5
rpn_negative_overlap: 0.3
rpn_positive_overlap: 0.7
rpn_straddle_thresh: 0.0
train_proposal:
min_size: 0.0
nms_thresh: 0.7
post_nms_top_n: 2000
pre_nms_top_n: 2000
test_proposal:
min_size: 0.0
nms_thresh: 0.7
post_nms_top_n: 1000
pre_nms_top_n: 1000
FPNRoIAlign:
canconical_level: 4
canonical_size: 224
max_level: 5
min_level: 2
box_resolution: 7
sampling_ratio: 2
BBoxAssigner:
batch_size_per_im: 512
bbox_reg_weights: [0.1, 0.1, 0.2, 0.2]
bg_thresh_hi: 0.5
bg_thresh_lo: 0.0
fg_fraction: 0.25
fg_thresh: 0.5
BBoxHead:
head: TwoFCHead
nms:
keep_top_k: 100
nms_threshold: 0.5
score_threshold: 0.05
TwoFCHead:
mlp_dim: 1024
LearningRate:
base_lr: 0.0025
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [7122, 9800]
- !LinearWarmup
start_factor: 0.333
steps: 500
OptimizerBuilder:
optimizer:
momentum: 0.9
type: Momentum
regularizer:
factor: 0.0001
type: L2
TrainReader:
inputs_def:
fields: ['image', 'im_info', 'im_id', 'gt_bbox', 'gt_class', 'is_crowd']
......@@ -28,7 +131,7 @@ TrainReader:
- !PadBatch
pad_to_stride: 32
use_padded_im_info: false
batch_size: 1
batch_size: 2
shuffle: true
worker_num: 2
use_process: false
......
architecture: FCOS
max_iters: 3558
max_iters: 11000
use_gpu: true
snapshot_iter: 1000
log_smooth_window: 20
log_iter: 20
save_dir: output
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar
metric: COCO
weights: output/fcos_r50_fpn_1x/model_final
weights: output/fcos_r50_fpn_multiscale_2x/model_final
num_classes: 6
FCOS:
......@@ -16,11 +16,13 @@ FCOS:
fcos_head: FCOSHead
ResNet:
norm_type: affine_channel
norm_type: bn
norm_decay: 0.
depth: 50
feature_maps: [3, 4, 5]
freeze_at: 2
dcn_v2_stages: [3, 4, 5]
variant: d
FPN:
min_level: 3
......@@ -38,7 +40,7 @@ FCOSHead:
fcos_loss: FCOSLoss
norm_reg_targets: True
centerness_on_reg: True
use_dcn_in_tower: False
use_dcn_in_tower: True
nms: MultiClassNMS
MultiClassNMS:
......@@ -59,7 +61,7 @@ LearningRate:
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [2372, 3261]
milestones: [7122, 9800]
- !LinearWarmup
start_factor: 0.3333333333333333
steps: 500
......@@ -92,7 +94,7 @@ TrainReader:
mean: [0.485,0.456,0.406]
std: [0.229, 0.224,0.225]
- !ResizeImage
target_size: 800
target_size: [640, 672, 704, 736, 768, 800]
max_size: 1333
interp: 1
use_cv2: true
......
architecture: YOLOv3
use_gpu: true
max_iters: 1780
max_iters: 11000
log_smooth_window: 20
save_dir: output
snapshot_iter: 1000
......@@ -21,9 +21,9 @@ DarkNet:
YOLOv3Head:
anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]]
anchors: [[10, 13], [16, 30], [33, 23],
[30, 61], [62, 45], [59, 119],
[116, 90], [156, 198], [373, 326]]
anchors: [[12, 22], [19, 20], [30, 20],
[22, 28], [16, 41], [45, 22],
[26, 43], [36, 34], [53, 53]]
norm_decay: 0.
yolo_loss: YOLOv3Loss
nms:
......@@ -35,11 +35,6 @@ YOLOv3Head:
score_threshold: 0.01
YOLOv3Loss:
# batch_size here is only used for fine grained loss, not used
# for training batch_size setting, training batch_size setting
# is in configs/yolov3_reader.yml TrainReader.batch_size, batch
# size here should be set as same value as TrainReader.batch_size
batch_size: 8
ignore_thresh: 0.7
label_smooth: true
......@@ -49,8 +44,8 @@ LearningRate:
- !PiecewiseDecay
gamma: 0.1
milestones:
- 1180
- 1630
- 7122
- 9800
- !LinearWarmup
start_factor: 0.
steps: 500
......@@ -63,4 +58,102 @@ OptimizerBuilder:
factor: 0.0005
type: L2
_READER_: 'yolov3_reader.yml'
TrainReader:
inputs_def:
fields: ['image', 'gt_bbox', 'gt_class', 'gt_score']
num_max_boxes: 50
dataset:
!COCODataSet
image_dir: images
anno_path: Annotations/train.json
dataset_dir: /home/aistudio/work/PCB_DATASET/
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
- !NormalizeBox {}
- !PadBox
num_max_boxes: 50
- !BboxXYXY2XYWH {}
batch_transforms:
- !RandomShape
sizes: [640, 704, 768, 832, 896, 960]
random_inter: 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
# Gt2YoloTarget is only used when use_fine_grained_loss set as true,
# this operator will be deleted automatically if use_fine_grained_loss
# is set as false
- !Gt2YoloTarget
anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]]
anchors: [[12, 22], [19, 20], [30, 20],
[22, 28], [16, 41], [45, 22],
[26, 43], [36, 34], [53, 53]]
downsample_ratios: [32, 16, 8]
batch_size: 4
shuffle: true
drop_last: true
worker_num: 8
bufsize: 4
use_process: true
EvalReader:
inputs_def:
fields: ['image', 'im_size', 'im_id']
num_max_boxes: 50
dataset:
!COCODataSet
image_dir: images
anno_path: Annotations/val.json
dataset_dir: /home/aistudio/work/PCB_DATASET/
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
- !ResizeImage
target_size: 896
interp: 2
- !NormalizeImage
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
is_scale: True
is_channel_first: false
- !PadBox
num_max_boxes: 50
- !Permute
to_bgr: false
channel_first: True
batch_size: 2
drop_empty: false
worker_num: 8
bufsize: 4
TestReader:
inputs_def:
image_shape: [3, 896, 896]
fields: ['image', 'im_size', 'im_id']
dataset:
!ImageFolder
anno_path: /home/aistudio/work/PCB_DATASET/Annotations/val.json
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
- !ResizeImage
target_size: 896
interp: 2
- !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
TrainReader:
inputs_def:
fields: ['image', 'gt_bbox', 'gt_class', 'gt_score']
num_max_boxes: 50
dataset:
!COCODataSet
image_dir: images
anno_path: Annotations/train.json
dataset_dir: /home/aistudio/work/PCB_DATASET
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
with_mixup: True
- !MixupImage
alpha: 1.5
beta: 1.5
- !ColorDistort {}
- !RandomExpand
fill_value: [123.675, 116.28, 103.53]
- !RandomCrop {}
- !RandomFlipImage
is_normalized: false
- !NormalizeBox {}
- !PadBox
num_max_boxes: 50
- !BboxXYXY2XYWH {}
batch_transforms:
- !RandomShape
sizes: [320, 352, 384, 416, 448, 480, 512, 544, 576, 608]
random_inter: 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
# Gt2YoloTarget is only used when use_fine_grained_loss set as true,
# this operator will be deleted automatically if use_fine_grained_loss
# is set as false
- !Gt2YoloTarget
anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]]
anchors: [[10, 13], [16, 30], [33, 23],
[30, 61], [62, 45], [59, 119],
[116, 90], [156, 198], [373, 326]]
downsample_ratios: [32, 16, 8]
batch_size: 8
shuffle: true
mixup_epoch: 250
drop_last: true
worker_num: 8
bufsize: 16
use_process: true
EvalReader:
inputs_def:
fields: ['image', 'im_size', 'im_id']
num_max_boxes: 50
dataset:
!COCODataSet
image_dir: images
anno_path: Annotations/val.json
dataset_dir: /home/aistudio/work/PCB_DATASET
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
- !ResizeImage
target_size: 608
interp: 2
- !NormalizeImage
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
is_scale: True
is_channel_first: false
- !PadBox
num_max_boxes: 50
- !Permute
to_bgr: false
channel_first: True
batch_size: 8
drop_empty: false
worker_num: 8
bufsize: 16
TestReader:
inputs_def:
image_shape: [3, 608, 608]
fields: ['image', 'im_size', 'im_id']
dataset:
!ImageFolder
anno_path: /home/aistudio/work/PCB_DATASET/Annotations/val.json
with_background: false
sample_transforms:
- !DecodeImage
to_rgb: True
- !ResizeImage
target_size: 608
interp: 2
- !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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册