diff --git a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml index 5464c95504b5be2fc334605100f8ad9af4854b2d..91e45ff54c31b1092a2863b015a2d944ba3b678e 100644 --- a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml +++ b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml @@ -1,52 +1,11 @@ _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 diff --git a/deploy/python/infer.py b/deploy/python/infer.py index ed28fee63699d31f1404aa3a20c2b5f0f0139d83..81daa1dbd37485793a53ad60b0112e2ddf3bc60d 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -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 diff --git a/ppdet/data/source/dataset.py b/ppdet/data/source/dataset.py index 2eeaf6e70682361b0fc07964e7bffc85cba394a2..d378b4da5e010a4872f8bb0fb26a769a00b9a677 100644 --- a/ppdet/data/source/dataset.py +++ b/ppdet/data/source/dataset.py @@ -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): diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index 855c57b03694217aa4f7f46914e12c3dc78c466d..7c061cea5d18c40fd3ff5947bb981cbd2d8546af 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -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()