Exemple #1
0
 def __init__(self, pretrained=True, include_top=False, freeze=True):
     super().__init__()
     backbone = vision.resnet18(pretrained=pretrained,
                                include_top=include_top,
                                freeze=freeze)
     output_size = backbone.get_output_size()
     head = nn.Linear(output_size, num_classes)
     self.model = torch.nn.Sequential(backbone, head)
Exemple #2
0
 def test_resnet18_ipex(self):
     resnet18 = vision.resnet18(pretrained=False,
                                include_top=False,
                                freeze=True)
     train_with_linear_top_layer(resnet18,
                                 batch_size,
                                 num_workers,
                                 data_dir,
                                 use_orca_lite_trainer=True)
 def test_resnet18_quantitrain_image_folder_pngze(self):
     resnet18 = vision.resnet18(pretrained=False,
                                include_top=False,
                                freeze=True)
     train_torch_lightning(resnet18, root_dir1, batch_size)
     train_torch_lightning(resnet18, root_dir2, batch_size)
Exemple #4
0
 def test_resnet18_ipex(self):
     resnet18 = vision.resnet18(
         pretrained=False, include_top=False, freeze=True)
     train_with_linear_top_layer(
         resnet18, batch_size, num_workers, data_dir,
         accelerator=IPEXAccelerator())