未验证 提交 c8678c3b 编写于 作者: F Feng Ni 提交者: GitHub

Fix slice image deploy infer index (#7317)

* remove duplicate backbone variant, test=document_fix

* fix slice_image deploy infer index
上级 a5816de8
_BASE_: [
'./_base_/visdrone_sliced_640_025_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
'ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml',
]
log_iter: 100
snapshot_epoch: 10
weights: output/ppyoloe_crn_l_80e_sliced_visdrone_640_025/model_final
weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
TrainReader:
batch_size: 8
EvalReader:
batch_size: 1 # only support bs=1 when slice infer
TestReader:
batch_size: 1
fuse_normalize: True
epoch: 80
LearningRate:
base_lr: 0.01
schedulers:
- !CosineDecay
max_epochs: 96
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 10000
keep_top_k: 500
score_threshold: 0.01
nms_threshold: 0.6
# very slow, preferly eval with a determined weights(xx.pdparams)
# if you want to eval during training, change SlicedCOCODataSet to COCODataSet and delete sliced_size/overlap_ratio
# very slow, better to use the determined weight (xx. pdparams) to evaluate separately, rather than evaling during training
# if you want to eval during training, change SlicedCOCODataSet to COCODataSet, then delete sliced_size and overlap_ratio
EvalDataset:
!SlicedCOCODataSet
image_dir: VisDrone2019-DET-val
......
......@@ -257,7 +257,7 @@ class Detector(object):
overlap_width_ratio=overlap_ratio[1])
sub_img_num = len(slice_image_result)
merged_bboxs = []
print('sub_img_num', sub_img_num)
print('slice to {} sub_samples.', sub_img_num)
batch_image_list = [
slice_image_result.images[_ind] for _ind in range(sub_img_num)
......@@ -306,7 +306,7 @@ class Detector(object):
st, ed = 0, result['boxes_num'][0] # start_index, end_index
for _ind in range(sub_img_num):
boxes_num = result['boxes_num'][_ind]
ed = boxes_num
ed = st + boxes_num
shift_amount = slice_image_result.starting_pixels[_ind]
result['boxes'][st:ed][:, 2:4] = result['boxes'][
st:ed][:, 2:4] + shift_amount
......
......@@ -254,7 +254,8 @@ class ImageFolder(DetDataset):
records.append(rec)
ct_sub += sub_img_num
ct += 1
print('{} samples and slice to {} sub_samples'.format(ct, ct_sub))
logger.info('{} samples and slice to {} sub_samples.'.format(ct,
ct_sub))
self.roidbs = records
def get_label_list(self):
......
......@@ -746,9 +746,11 @@ class Trainer(object):
output_dir='output',
save_results=False,
visualize=True):
if not os.path.exists(output_dir):
os.makedirs(output_dir)
self.dataset.set_slice_images(images, slice_size, overlap_ratio)
loader = create('TestReader')(self.dataset, 0)
imid2path = self.dataset.get_imid2path()
anno_file = self.dataset.get_anno()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册