import json import os import datetime from model_module import ModelBuilder from ResNetTester_cls import ResNetTester, make, check_run from Datasets import (cifer10_datasets, cifer100_datasets, mnist_dataset) from tools import converter_json global_name = "20190930_test" loop = 3 relu_option = False epochs = 1 split = 1.0 batch_size = 32 dataset = cifer10_datasets(is_zero_center=True) json_file = "options/20190930_options_bk.json" result_file = [] for i in range(loop): global_loop_name = global_name + str(i) json_experience = "" with open(json_file) as f: s = f.read() json_experience = json.loads(s) for e in json_experience["options"]: filename = 'result/' + global_loop_name + '.json' isRuned = check_run(e, filename) result_file.append(filename)
''' それぞれのネットワークの評価コード ''' import numpy as np import sklearn.metrics as metrics from ModelBuilder import ResnetBuilder from plot_result import (plot_acc_history, plot_loss_history, outputfile_evalute, get_time) from ResNetTester_cls import ResNetTester from Datasets import cifer10_datasets data = cifer10_datasets() Testers = [ ResNetTester('ResNet18'), ResNetTester('Invert_ResNet18'), ResNetTester('Dual_ReLU_ResNet18'), ResNetTester('Dual_ReLU_Concatenate_ResNet18') ] output_log_file = get_time() + '_' + 'result.txt' for index, test in enumerate(Testers): test.setDataset(data) if index == 0: model = ResnetBuilder.build_resnet_18(data.init_shape, 10) elif index == 1: model = ResnetBuilder.build_invert_relu_resnet_18(data.init_shape, 10) elif index == 2: model = ResnetBuilder.build_dualresnet_18(data.init_shape, 10) elif index == 3:
#from ModelBuilder import ResnetBuilder from model_module import ModelBuilder from Datasets import (cifer10_datasets, cifer100_datasets, mnist_dataset) from keras.utils import plot_model dataset = cifer10_datasets(is_zero_center=False) option = { "relu_option": False, "double_input": False, "concatenate": "none", "block": "basic_block", "reseption": [2, 2, 2, 2], "dropout": 0, "wide": False, "filters": 64 } model = ModelBuilder.ResnetBuilder.build_manual(dataset.get_shape(), dataset.get_categorical(), option) model.summary() plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=True)