Пример #1
0
    def test_05_load_model(self):
        path = ROOT_PATH
        manager = InstanceManager(path)

        model = DummyModel
        input_shape = (32, 32, 3)
        manager.gen_instance(model, input_shape)
        meta_data_path = manager.metadata_path

        visualizer_1 = DummyVisualizer_1
        visualizer_2 = DummyVisualizer_2

        visualizers = [visualizer_1, visualizer_2]
        manager.load_visualizer(visualizers)

        dataset = DummyDataset()
        epoch_time = 10
        check_point_interval = 2
        manager.train_model(dataset, epoch_time, check_point_interval)

        #
        manager = InstanceManager(path)
        manager.load_model(meta_data_path, input_shape)

        visualizer_1 = DummyVisualizer_1
        visualizer_2 = DummyVisualizer_2

        visualizers = [visualizer_1, visualizer_2]
        manager.load_visualizer(visualizers)

        dataset = DummyDataset()
        epoch_time = 10
        check_point_interval = 2
        manager.train_model(dataset, epoch_time, check_point_interval)
Пример #2
0
    def test_01_gen_model(self):
        path = ROOT_PATH
        manager = InstanceManager(path)

        model = DummyModel
        input_shape = (32, 32, 3)
        manager.gen_instance(model, input_shape)
Пример #3
0
    def gen_model_and_train(model=None, input_shapes=None, dataset=None, visualizers=None, env_path=None, epoch_time=50,
                            check_point_interval_per_iter=5000):
        manager = InstanceManager(env_path)
        manager.gen_instance(model, input_shapes)
        manager.load_visualizer(visualizers)

        manager.open_tensorboard()
        manager.train_model(dataset, epoch_time, check_point_interval_per_iter)
        manager.close_tensorboard()
        del manager
Пример #4
0
    def test_02_load_visualizer(self):
        path = ROOT_PATH
        manager = InstanceManager(path)

        model = DummyModel
        input_shape = (32, 32, 3)
        manager.gen_instance(model, input_shape)

        visualizer_1 = DummyVisualizer_1
        visualizer_2 = DummyVisualizer_2

        visualizers = [visualizer_1, visualizer_2]
        manager.load_visualizer(visualizers)
Пример #5
0
    def test_03_train_model(self):
        path = ROOT_PATH
        manager = InstanceManager(path)

        model = DummyModel
        input_shape = (32, 32, 3)
        manager.gen_instance(model, input_shape)

        visualizer_1 = DummyVisualizer_1
        visualizer_2 = DummyVisualizer_2

        visualizers = [visualizer_1, visualizer_2]
        manager.load_visualizer(visualizers)

        dataset = DummyDataset()
        epoch_time = 10
        manager.train_model(dataset, epoch_time)
Пример #6
0
def f():
    path = ROOT_PATH
    manager = InstanceManager(path)

    model = DummyModel
    input_shape = (32, 32, 3)
    manager.gen_instance(model, input_shape)

    visualizers = [
        (dummy_log, 10),
    ]
    manager.load_visualizer(visualizers)

    dataset = DummyDataset()
    epoch_time = 1
    check_point_interval = 500
    manager.train_model(dataset, epoch_time, check_point_interval)
Пример #7
0
import os


class dummy_log(AbstractPrintLog):
    def task(self, sess=None, iter_num=None, model=None, dataset=None):
        super().task(sess, iter_num, model, dataset)
        self.log('this is dummy log')


if __name__ == '__main__':
    root_path = ROOT_PATH
    LLD_PATH = os.path.join(root_path, 'dataset', 'LLD')
    lld_data = LLD()
    lld_data.load(LLD_PATH)

    manager = InstanceManager(ROOT_PATH)

    input_shape = [32, 32, 3]
    model = GAN
    manager.gen_instance(model, input_shape)
    metadata_path = manager.metadata_path

    iter_cycle = 10
    visualizers = [(dummy_log, iter_cycle)]
    manager.load_visualizer(visualizers)

    epoch_time = 10
    check_point_interval_per_iter = 5000
    manager.train_model(lld_data, epoch_time, check_point_interval_per_iter)
Пример #8
0
 def test_models(model_list=None, input_shapes=None, env_setting=None):
     for model in model_list:
         manager = InstanceManager(env_setting)
         manager.gen_instance(model, input_shapes)
         del manager