未验证 提交 a3bf27da 编写于 作者: C CodesFarmer 提交者: GitHub

keep the option 'num_classes' and 'with_background' consistent (#727)

上级 1b16f475
...@@ -8,7 +8,7 @@ save_dir: output ...@@ -8,7 +8,7 @@ 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_cos_pretrained.tar
metric: COCO metric: COCO
weights: output/fcos_dcn_r50_fpn_1x/model_final weights: output/fcos_dcn_r50_fpn_1x/model_final
num_classes: 81 num_classes: 80
FCOS: FCOS:
backbone: ResNet backbone: ResNet
...@@ -32,7 +32,7 @@ FPN: ...@@ -32,7 +32,7 @@ FPN:
has_extra_convs: true has_extra_convs: true
FCOSHead: FCOSHead:
num_classes: 81 num_classes: 80
fpn_stride: [8, 16, 32, 64, 128] fpn_stride: [8, 16, 32, 64, 128]
num_convs: 4 num_convs: 4
norm_type: "gn" norm_type: "gn"
...@@ -81,7 +81,7 @@ TrainReader: ...@@ -81,7 +81,7 @@ TrainReader:
image_dir: train2017 image_dir: train2017
anno_path: annotations/instances_train2017.json anno_path: annotations/instances_train2017.json
dataset_dir: dataset/coco dataset_dir: dataset/coco
with_background: true with_background: false
sample_transforms: sample_transforms:
- !DecodeImage - !DecodeImage
to_rgb: true to_rgb: true
...@@ -111,7 +111,7 @@ TrainReader: ...@@ -111,7 +111,7 @@ TrainReader:
norm_reg_targets: True norm_reg_targets: True
batch_size: 2 batch_size: 2
shuffle: true shuffle: true
worker_num: 16 worker_num: 4
use_process: false use_process: false
EvalReader: EvalReader:
...@@ -144,9 +144,9 @@ EvalReader: ...@@ -144,9 +144,9 @@ EvalReader:
- !PadBatch - !PadBatch
pad_to_stride: 128 pad_to_stride: 128
use_padded_im_info: true use_padded_im_info: true
batch_size: 8 batch_size: 1
shuffle: false shuffle: false
worker_num: 2 worker_num: 1
use_process: false use_process: false
TestReader: TestReader:
......
...@@ -8,7 +8,7 @@ save_dir: output ...@@ -8,7 +8,7 @@ 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_cos_pretrained.tar
metric: COCO metric: COCO
weights: output/fcos_r50_fpn_1x/model_final weights: output/fcos_r50_fpn_1x/model_final
num_classes: 81 num_classes: 80
FCOS: FCOS:
backbone: ResNet backbone: ResNet
...@@ -31,7 +31,7 @@ FPN: ...@@ -31,7 +31,7 @@ FPN:
has_extra_convs: true has_extra_convs: true
FCOSHead: FCOSHead:
num_classes: 81 num_classes: 80
fpn_stride: [8, 16, 32, 64, 128] fpn_stride: [8, 16, 32, 64, 128]
num_convs: 4 num_convs: 4
norm_type: "gn" norm_type: "gn"
...@@ -80,7 +80,7 @@ TrainReader: ...@@ -80,7 +80,7 @@ TrainReader:
image_dir: train2017 image_dir: train2017
anno_path: annotations/instances_train2017.json anno_path: annotations/instances_train2017.json
dataset_dir: dataset/coco dataset_dir: dataset/coco
with_background: true with_background: false
sample_transforms: sample_transforms:
- !DecodeImage - !DecodeImage
to_rgb: true to_rgb: true
...@@ -110,7 +110,7 @@ TrainReader: ...@@ -110,7 +110,7 @@ TrainReader:
norm_reg_targets: True norm_reg_targets: True
batch_size: 2 batch_size: 2
shuffle: true shuffle: true
worker_num: 16 worker_num: 4
use_process: false use_process: false
EvalReader: EvalReader:
...@@ -143,7 +143,7 @@ EvalReader: ...@@ -143,7 +143,7 @@ EvalReader:
- !PadBatch - !PadBatch
pad_to_stride: 128 pad_to_stride: 128
use_padded_im_info: true use_padded_im_info: true
batch_size: 8 batch_size: 1
shuffle: false shuffle: false
worker_num: 2 worker_num: 2
use_process: false use_process: false
......
...@@ -8,7 +8,7 @@ save_dir: output ...@@ -8,7 +8,7 @@ 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_cos_pretrained.tar
metric: COCO metric: COCO
weights: output/fcos_r50_fpn_multiscale_2x/model_final weights: output/fcos_r50_fpn_multiscale_2x/model_final
num_classes: 81 num_classes: 80
FCOS: FCOS:
backbone: ResNet backbone: ResNet
...@@ -31,7 +31,7 @@ FPN: ...@@ -31,7 +31,7 @@ FPN:
has_extra_convs: true has_extra_convs: true
FCOSHead: FCOSHead:
num_classes: 81 num_classes: 80
fpn_stride: [8, 16, 32, 64, 128] fpn_stride: [8, 16, 32, 64, 128]
num_convs: 4 num_convs: 4
norm_type: "gn" norm_type: "gn"
...@@ -80,7 +80,7 @@ TrainReader: ...@@ -80,7 +80,7 @@ TrainReader:
image_dir: train2017 image_dir: train2017
anno_path: annotations/instances_train2017.json anno_path: annotations/instances_train2017.json
dataset_dir: dataset/coco dataset_dir: dataset/coco
with_background: true with_background: false
sample_transforms: sample_transforms:
- !DecodeImage - !DecodeImage
to_rgb: true to_rgb: true
...@@ -110,7 +110,7 @@ TrainReader: ...@@ -110,7 +110,7 @@ TrainReader:
norm_reg_targets: True norm_reg_targets: True
batch_size: 2 batch_size: 2
shuffle: true shuffle: true
worker_num: 16 worker_num: 4
use_process: false use_process: false
EvalReader: EvalReader:
...@@ -143,7 +143,7 @@ EvalReader: ...@@ -143,7 +143,7 @@ EvalReader:
- !PadBatch - !PadBatch
pad_to_stride: 128 pad_to_stride: 128
use_padded_im_info: true use_padded_im_info: true
batch_size: 8 batch_size: 1
shuffle: false shuffle: false
worker_num: 2 worker_num: 2
use_process: false use_process: false
......
...@@ -439,7 +439,7 @@ class Gt2FCOSTarget(BaseOperator): ...@@ -439,7 +439,7 @@ class Gt2FCOSTarget(BaseOperator):
points2gtarea[is_match_current_level == 0] = self.INF points2gtarea[is_match_current_level == 0] = self.INF
points2min_area = points2gtarea.min(axis=1) points2min_area = points2gtarea.min(axis=1)
points2min_area_ind = points2gtarea.argmin(axis=1) points2min_area_ind = points2gtarea.argmin(axis=1)
labels = gt_class[points2min_area_ind] labels = gt_class[points2min_area_ind] + 1
labels[points2min_area == self.INF] = 0 labels[points2min_area == self.INF] = 0
reg_targets = reg_targets[range(xs.shape[0]), points2min_area_ind] reg_targets = reg_targets[range(xs.shape[0]), points2min_area_ind]
ctn_targets = np.sqrt((reg_targets[:, [0, 2]].min(axis=1) / \ ctn_targets = np.sqrt((reg_targets[:, [0, 2]].min(axis=1) / \
......
...@@ -50,7 +50,7 @@ class FCOSHead(object): ...@@ -50,7 +50,7 @@ class FCOSHead(object):
__shared__ = ['num_classes'] __shared__ = ['num_classes']
def __init__(self, def __init__(self,
num_classes=81, num_classes=80,
fpn_stride=[8, 16, 32, 64, 128], fpn_stride=[8, 16, 32, 64, 128],
prior_prob=0.01, prior_prob=0.01,
num_convs=4, num_convs=4,
...@@ -65,7 +65,7 @@ class FCOSHead(object): ...@@ -65,7 +65,7 @@ class FCOSHead(object):
keep_top_k=100, keep_top_k=100,
nms_threshold=0.45, nms_threshold=0.45,
background_label=-1).__dict__): background_label=-1).__dict__):
self.num_classes = num_classes - 1 self.num_classes = num_classes
self.fpn_stride = fpn_stride[::-1] self.fpn_stride = fpn_stride[::-1]
self.prior_prob = prior_prob self.prior_prob = prior_prob
self.num_convs = num_convs self.num_convs = num_convs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册