コード例 #1
0
 def _imp(hp_dict, cuda_id, save_path):
     model = models.DenseNetBC(**hp_dict, n_cls=experimental_settings.n_cls)
     train_data, test_data = datasets.get_data(train_dataset,
                                               test_dataset,
                                               batch_size=model.batch_size)
     return evaluating_model(model, hp_dict, train_data, test_data, cuda_id,
                             save_path)
コード例 #2
0
 def _imp(hp_dict, cuda_id, save_path):
     model = models.MultiLayerPerceptron(**hp_dict,
                                         n_cls=experimental_settings.n_cls,
                                         image_size=image_size)
     train_data, test_data = datasets.get_data(train_dataset,
                                               test_dataset,
                                               batch_size=model.batch_size)
     return evaluating_model(model, hp_dict, train_data, test_data, cuda_id,
                             save_path)
コード例 #3
0
 def _imp(hp_dict, cuda_id, save_path):
     args = models.Transfer(**hp_dict, \
         n_cls=experimental_settings.n_cls, \
         epochs=experimental_settings.epochs, \
         opt=experimental_settings.opt, \
         mtra=experimental_settings.mtransfer, \
         gcam=experimental_settings.gcam
         )
     train_data, test_data = datasets.get_data(train_dataset,
                                               test_dataset,
                                               batch_size=args.batch_size)
     if experimental_settings.mtransfer.upper() == "RESNET50":
         model = m.resnet50(pretrained=True)
         num_ftrs = model.fc.in_features
     elif experimental_settings.mtransfer.upper() == "RESNET152":
         model = m.resnet50(pretrained=True)
         num_ftrs = model.fc.in_features
     elif experimental_settings.mtransfer.upper() == "EFF7":
         model = EfficientNet.from_pretrained('efficientnet-b7')
         num_ftrs = model._fc.in_features
     elif experimental_settings.mtransfer.upper() == "EFF0":
         model = EfficientNet.from_pretrained('efficientnet-b0')
         num_ftrs = model._fc.in_features
     elif experimental_settings.mtransfer.upper() == "WRN50_2":
         model = torch.hub.load('pytorch/vision:v0.6.0',
                                'wide_resnet50_2',
                                pretrained=True)
         num_ftrs = model.fc.in_features
     elif experimental_settings.mtransfer.upper() == "WRN101_2":
         model = torch.hub.load('pytorch/vision:v0.6.0',
                                'wide_resnet50_2',
                                pretrained=True)
         num_ftrs = model.fc.in_features
     model.fc = nn.Linear(num_ftrs, experimental_settings.n_cls)
     return evaluating_model_t(model, hp_dict, train_data, test_data,
                               cuda_id, save_path, args, train_idx,
                               valid_idx)
コード例 #4
0
 def _imp(hp_dict, cuda_id, save_path):
     model = models.CNN(**hp_dict, n_cls=experimental_settings["n_cls"])
     train_data, test_data = datasets.get_data(train_dataset,
                                               test_dataset,
                                               batch_size=model.batch_size)
     return train(model, hp_dict, train_data, test_data, cuda_id, save_path)