(self, mode='train')
| 31 | return model |
| 32 | |
| 33 | def _get_dataset(self, mode='train'): |
| 34 | if mode == 'train': |
| 35 | pipeline = [ |
| 36 | dict( |
| 37 | type='MMResize', |
| 38 | img_scale=[(1333, 640), (1333, 672), (1333, 704), |
| 39 | (1333, 736), (1333, 768), (1333, 800)], |
| 40 | multiscale_mode='value', |
| 41 | keep_ratio=True), |
| 42 | dict(type='MMRandomFlip', flip_ratio=0.5), |
| 43 | dict(type='MMNormalize', **IMG_NORM_CFG_255), |
| 44 | dict(type='MMPad', size_divisor=32), |
| 45 | dict(type='DefaultFormatBundle'), |
| 46 | dict( |
| 47 | type='Collect', |
| 48 | keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks'], |
| 49 | meta_keys=('filename', 'ori_filename', 'ori_shape', |
| 50 | 'ori_img_shape', 'img_shape', 'pad_shape', |
| 51 | 'scale_factor', 'flip', 'flip_direction', |
| 52 | 'img_norm_cfg')) |
| 53 | ] |
| 54 | else: |
| 55 | pipeline = [ |
| 56 | dict( |
| 57 | type='MMMultiScaleFlipAug', |
| 58 | img_scale=(1333, 800), |
| 59 | flip=False, |
| 60 | transforms=[ |
| 61 | dict(type='MMResize', keep_ratio=True), |
| 62 | dict(type='MMRandomFlip'), |
| 63 | dict(type='MMNormalize', **IMG_NORM_CFG_255), |
| 64 | dict(type='MMPad', size_divisor=32), |
| 65 | dict(type='ImageToTensor', keys=['img']), |
| 66 | dict( |
| 67 | type='Collect', |
| 68 | keys=['img'], |
| 69 | meta_keys=('filename', 'ori_filename', 'ori_shape', |
| 70 | 'ori_img_shape', 'img_shape', |
| 71 | 'pad_shape', 'scale_factor', 'flip', |
| 72 | 'flip_direction', 'img_norm_cfg')), |
| 73 | ]) |
| 74 | ] |
| 75 | |
| 76 | data_root = DET_DATA_SMALL_COCO_LOCAL |
| 77 | dataset_cfg = dict( |
| 78 | type='DetDataset', |
| 79 | data_source=dict( |
| 80 | type='DetSourceCoco', |
| 81 | ann_file=os.path.join(data_root, |
| 82 | 'instances_train2017_20.json'), |
| 83 | img_prefix=os.path.join(data_root, 'train2017'), |
| 84 | pipeline=[ |
| 85 | dict(type='LoadImageFromFile', to_float32=True), |
| 86 | dict( |
| 87 | type='LoadAnnotations', with_bbox=True, with_mask=True) |
| 88 | ], |
| 89 | classes=COCO_CLASSES, |
| 90 | filter_empty_gt=False, |
no test coverage detected