Ejemplo n.º 1
0
 def eval_model(embedding = None, metamodel = None):
     model = metamodel
     if model is None:
         model = MetaModel(hyperparameters)
         if embedding is None:
             model.populate_with_nasnet_metacells()
         else:
             model.populate_from_embedding(embedding)
         model.build_model(dataset.images_shape)
     model.evaluate(dataset, 1, dir_path)
     model.save_metadata(dir_path)
     model.save_model(dir_path)
     model.generate_graph(dir_path)
     model.clear_model()
     tf.keras.backend.clear_session()
Ejemplo n.º 2
0
def test_model_accuracy_from_embedding(dir_name, embedding):
    dir_path = os.path.join(evo_dir, dir_name)
    # dataset = ImageDataset.get_cifar10_reduced()
    dataset = ImageDataset.get_cifar10()

    if not os.path.exists(dir_path):
        os.makedirs(dir_path)

    hyperparameters = Hyperparameters()

    model = MetaModel(hyperparameters)

    model.populate_from_embedding(embedding)

    model.build_model(dataset.images_shape)
    model.evaluate(dataset)
    model.save_model(dir_path)
    model.generate_graph(dir_path)
    model.save_metadata(dir_path)
    model.clear_model()