From 510396451c26d0e2e8e513271224b0a057b36e78 Mon Sep 17 00:00:00 2001 From: Vetlets05 Date: Tue, 5 Nov 2024 19:51:41 +0100 Subject: [PATCH] fix: made changes to config --- main.py | 2 +- src/environments/mario_env.py | 2 +- src/utils/config.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index eb4b1e7..c6606ad 100644 --- a/main.py +++ b/main.py @@ -88,7 +88,7 @@ def main(args): if neat is not None: # TODO: Add option to insert new config into NEAT object. generation_nums, best_fitnesses, avg_fitnesses, min_fitnesses = read_fitness_file(neat_name) from_generation = generation_nums[-1] + 1 - #config_instance = neat.config + config_instance = neat.config else: neat = NEAT(Config()) neat.initiate_genomes() diff --git a/src/environments/mario_env.py b/src/environments/mario_env.py index 7b844cd..d7ff55c 100644 --- a/src/environments/mario_env.py +++ b/src/environments/mario_env.py @@ -95,7 +95,7 @@ def interpret_state(self, state: np.ndarray) -> np.ndarray: # Resize while preserving RGB channels state = resize( state, - (self.config.input_shape[0], self.config.input_shape[1], 3), + (self.config.input_shape[0], self.config.input_shape[1], self.config.input_channels), anti_aliasing=True, preserve_range=True ).astype(np.uint8) diff --git a/src/utils/config.py b/src/utils/config.py index 0dfdc18..f4b4aaf 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -7,8 +7,8 @@ class Config: c2: float = 1.5 c3: float = 0.4 genomic_distance_threshold: float = 2.69 - population_size: int = 40 # 56 cores on IDUN - generations: int = 2 # A bunch of iterations + population_size: int = 560 # 56 cores on IDUN + generations: int = 10 # A bunch of iterations connection_weight_mutation_chance: float = 0.8 @@ -24,9 +24,9 @@ class Config: # Connections should be added way more often than nodes num_output_nodes: int = 7 - input_shape: Tuple[int, int] = (20, 40) + input_shape: Tuple[int, int] = (10, 20) - input_channels: int = 3 + input_channels: int = 1 """If using RGB, value should be 3, if using grayscale, value should be 1""" num_input_nodes: int = input_shape[0] * input_shape[1] * input_channels