class config: dataset_name = 'COCO' network = 'resnet50_retinanet' pretrained = False num_classes = 80 input_image_size = 800 model = retinanet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) decoder = RetinaDecoder() val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ])) seed = 0 batch_size = 16 num_workers = 16 trained_model_path = 'detection_training/coco/retinanet_res50_resize800_multi_ciou/checkpoints/resnet50_retinanet-epoch12-mAP0.355.pth'
class config: dataset_name = 'COCO' network = 'resnet50_fcos' pretrained = False num_classes = 80 input_image_size = 800 model = fcos.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) decoder = FCOSDecoder() val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ])) seed = 0 # when testing,using nn.DataParallel mode,batch_size is total size batch_size = 16 num_workers = 16 trained_model_path = 'detection_training/coco/fcos_res50_resize800_multi_ciou/checkpoints/resnet50_fcos-epoch12-mAP0.37735844188817935.pth'
class config: dataset_name = 'COCO' network = 'resnet18_centernet' pretrained = False num_classes = 80 input_image_size = 512 model = centernet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) decoder = CenterNetDecoder() val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.6, 1.4]), ])) seed = 0 batch_size = 64 num_workers = 16 trained_model_path = ''
class config: dataset_name = 'COCO' network = 'yolov3' pretrained = False num_classes = 80 input_image_size = 416 model = yolov3.__dict__[network](**{ 'pretrained': pretrained, 'anchor_sizes': [[10, 13], [16, 30], [33, 23], [30, 61], [62, 45], [59, 119], [116, 90], [156, 198], [373, 326]], 'strides': [8, 16, 32], 'num_classes': num_classes, }) decoder = Yolov4Decoder() val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ])) seed = 0 batch_size = 64 num_workers = 16 trained_model_path = ''
class config: dataset_name = 'VOC' network = 'resnet50_retinanet' pretrained = False num_classes = 20 input_image_size = 400 model = retinanet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) decoder = RetinaDecoder() val_dataset = VocDetection(root_dir=VOCdataset_path, image_sets=[('2007', 'test')], transform=transforms.Compose([ Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ]), keep_difficult=False) seed = 0 batch_size = 64 num_workers = 16 eval_iou_threshold = 0.5 trained_model_path = 'detection_training/voc/retinanet_res50_resize400_multi_ciou/checkpoints/resnet50_retinanet-epoch12-mAP0.7711355083699912.pth'
class config: dataset_name = 'COCO' network = 'resnet50_fcos' pretrained = False num_classes = 80 input_image_size = 400 model = fcos.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) criterion = FCOSLoss(box_loss_iou_type='CIoU', box_loss_weight=1.) decoder = FCOSDecoder() train_dataset = CocoDetection(COCO2017_path, set_name='train2017', transform=transforms.Compose([ RandomHorizontalFlip(flip_prob=0.5), Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=True, multi_scale_range=[0.8, 1.0]), ])) val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ])) seed = 0 # batch_size is total size in DataParallel mode # batch_size is per gpu node size in DistributedDataParallel mode batch_size = 16 num_workers = 16 # choose 'SGD' or 'AdamW' optimizer = 'AdamW' # 'AdamW' doesn't need gamma and momentum variable gamma = 0.1 momentum = 0.9 # choose 'MultiStepLR' or 'CosineLR' # milestones only use in 'MultiStepLR' scheduler = 'MultiStepLR' lr = 1e-4 weight_decay = 1e-3 milestones = [8, 11] warm_up_epochs = 0 epochs = 12 eval_epoch = [1, 3, 5, 8, 11, 12] print_interval = 100 # only in DistributedDataParallel mode can use sync_bn distributed = True sync_bn = False apex = True
class config: dataset_name = 'COCO' network = 'resnet18_centernet' pretrained = False num_classes = 80 input_image_size = 512 model = centernet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) criterion = CenterNetLoss() decoder = CenterNetDecoder() train_dataset = CocoDetection(COCO2017_path, set_name='train2017', transform=transforms.Compose([ RandomHorizontalFlip(flip_prob=0.5), Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=True, multi_scale_range=[0.6, 1.4]), ])) val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.6, 1.4]), ])) seed = 0 # batch_size is total size in DataParallel mode # batch_size is per gpu node size in DistributedDataParallel mode batch_size = 64 num_workers = 16 # choose 'SGD' or 'AdamW' optimizer = 'AdamW' # 'AdamW' doesn't need gamma and momentum variable gamma = 0.1 momentum = 0.9 # choose 'MultiStepLR' or 'CosineLR' # milestones only use in 'MultiStepLR' scheduler = 'MultiStepLR' lr = 1e-4 weight_decay = 1e-3 milestones = [90, 120] warm_up_epochs = 0 epochs = 140 eval_epoch = [i * 5 for i in range(epochs // 5)] print_interval = 100 # only in DistributedDataParallel mode can use sync_bn distributed = True sync_bn = False apex = True
class config: dataset_name = 'VOC' network = 'resnet50_retinanet' pretrained = False num_classes = 20 input_image_size = 400 model = retinanet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) criterion = RetinaLoss() decoder = RetinaDecoder() train_dataset = VocDetection(root_dir=VOCdataset_path, image_sets=[('2007', 'trainval'), ('2012', 'trainval')], transform=transforms.Compose([ RandomHorizontalFlip(flip_prob=0.5), Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=True, multi_scale_range=[0.8, 1.0]), ]), keep_difficult=False) val_dataset = VocDetection(root_dir=VOCdataset_path, image_sets=[('2007', 'test')], transform=transforms.Compose([ Normalize(), RetinaStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ]), keep_difficult=False) seed = 0 # batch_size is total size in DataParallel mode # batch_size is per gpu node size in DistributedDataParallel mode batch_size = 16 num_workers = 16 # choose 'SGD' or 'AdamW' optimizer = 'AdamW' # 'AdamW' doesn't need gamma and momentum variable gamma = 0.1 momentum = 0.9 # choose 'MultiStepLR' or 'CosineLR' # milestones only use in 'MultiStepLR' scheduler = 'MultiStepLR' lr = 1e-4 weight_decay = 1e-3 milestones = [8, 11] warm_up_epochs = 0 epochs = 12 eval_epoch = [1, 3, 5, 8, 11, 12] eval_iou_threshold = 0.5 print_interval = 100 # only in DistributedDataParallel mode can use sync_bn distributed = True sync_bn = False apex = True
np.random.seed(seed) # for cpu gpu torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) from simpleAICV.detection.common import RandomHorizontalFlip, RandomCrop, RandomTranslate, Normalize, YoloStyleResize, RetinaStyleResize, DetectionCollater cocodataset = CocoDetection( COCO2017_path, set_name='train2017', transform=transforms.Compose([ RandomHorizontalFlip(), RandomCrop(), RandomTranslate(), Normalize(), #YoloStyleResize(resize=640, multi_scale=True), RetinaStyleResize(resize=800, multi_scale=True), ])) count = 0 for per_sample in tqdm(cocodataset): print(per_sample['image'].shape, per_sample['annots'].shape, per_sample['scale'], per_sample['origin_hw']) print(per_sample['image'].dtype, per_sample['annots'].dtype, per_sample['scale'].dtype, per_sample['origin_hw'].dtype) if count < 10: count += 1 else: break
class config: dataset_name = 'COCO' network = 'yolov4' pretrained = False num_classes = 80 input_image_size = 416 model = yolov4.__dict__[network](**{ 'pretrained': pretrained, 'anchor_sizes': [[10, 13], [16, 30], [33, 23], [30, 61], [62, 45], [59, 119], [116, 90], [156, 198], [373, 326]], 'strides': [8, 16, 32], 'num_classes': num_classes, }) criterion = Yolov4Loss( anchor_sizes=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45], [59, 119], [116, 90], [156, 198], [373, 326]], strides=[8, 16, 32], ) decoder = Yolov4Decoder() train_dataset = CocoDetection(COCO2017_path, set_name='train2017', transform=transforms.Compose([ RandomHorizontalFlip(flip_prob=0.5), Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=True, multi_scale_range=[0.8, 1.0]), ])) val_dataset = CocoDetection(COCO2017_path, set_name='val2017', transform=transforms.Compose([ Normalize(), YoloStyleResize( resize=input_image_size, multi_scale=False, multi_scale_range=[0.8, 1.0]), ])) seed = 0 # batch_size is total size in DataParallel mode # batch_size is per gpu node size in DistributedDataParallel mode batch_size = 32 num_workers = 16 # choose 'SGD' or 'AdamW' optimizer = 'AdamW' # 'AdamW' doesn't need gamma and momentum variable gamma = 0.1 momentum = 0.9 # choose 'MultiStepLR' or 'CosineLR' # milestones only use in 'MultiStepLR' scheduler = 'MultiStepLR' lr = 1e-4 weight_decay = 1e-3 milestones = [60, 90] warm_up_epochs = 0 epochs = 100 eval_epoch = [1, 2, 3, 4, 5] print_interval = 10 # only in DistributedDataParallel mode can use sync_bn distributed = True sync_bn = False apex = True