示例#1
0
 def test_from_model(self):
     from dlpy.applications import ResNet18_Caffe, VGG11
     vgg11 = VGG11(self.s)
     backbone1 = vgg11.to_functional_model(vgg11.layers[-2])
     self.assertEqual(backbone1.layers[-1].__class__.__name__, 'Dense')
     model_resnet18 = ResNet18_Caffe(self.s, n_classes = 6, random_crop = 'none', width = 400, height = 400)
     backbone2 = model_resnet18.to_functional_model(model_resnet18.layers[-3])
     self.assertEqual(backbone2.layers[-1].__class__.__name__, 'BN')
    def test_vgg11(self):
        from dlpy.applications import VGG11
        model = VGG11(self.s)
        model.print_summary()

        # test random_crop and mutation
        model1 = VGG11(self.s, model_table='VGG16', n_classes=1000, n_channels=3,
                       width=224, height=224, scale=1,
                       offsets=None,
                       random_crop='unique',
                       random_flip='hv',
                       random_mutation='random')

        model1.print_summary()
        res1 = self.s.fetch(table=model1.model_name, sortby='_dllayerid_')
        print(res1)

        self.assertEqual(res1['Fetch'].iloc[10, 3], 4)
        self.assertEqual(res1['Fetch'].iloc[4, 3], 2)
示例#3
0
 def test_vgg11(self):
     from dlpy.applications import VGG11
     model = VGG11(self.s)
     model.print_summary()