def __init__(self, dqn_path, banchmark_q, cloud_backend, recent_zone=10, explor_rate=0.2, acc_threshold=0.8, reward_threshold=0.45): # reward_threshold=0.35): feature_extractor = MobileNetV2(include_top=False) x = feature_extractor.output x = AveragePooling2D(pool_size=(4, 4))(x) self.feature_extractor = Model(inputs=feature_extractor.input, outputs=x) self.agent = DQN_Agent(s_dim=1280, a_dim=10, epsilon_decay=0.99, epsilon_min=0.02, gamma=0.95, replay_batchsize=256) self.agent.model = load_model(dqn_path) self.dqn_path = dqn_path self.agent.curr_exploration_rate = 0 self.STATUS = "INFERENCE" # INITIAL_TRAIN, INFERENCE, ESTIMATE, RETRAIN # self.STATUS = "INITIAL_TRAIN" self.STATUS = "RETRAIN" self.cloud_backend = cloud_backend self.banchmark_q = banchmark_q self.explor_rate = explor_rate self.recent_zone = recent_zone self.reward_threshold = reward_threshold self.acc_threshold = acc_threshold self.grad_scale_factor = 3 self.agent_memory = defaultdict(list) self.running_log = defaultdict(list) self.last_env_step = None self.step_count = 0 self.train_count = 0 self.load_model = 1 # self.flag = 'DNIM' self.flag = 'FLIR'
(imagenet_train_path, img_class, image_name)) image_paths.append(sample_image_path) return image_paths imagenet_paths = _gen_sample_set_imagenet('/home/imagenet-data/train/', 2) #MobileNetV2 # feature_extractor = MobileNetV2(include_top=False) # x = feature_extractor.output # x = AveragePooling2D(pool_size=(4, 4))(x) # feature_extractor = Model(inputs=feature_extractor.input, outputs=x) # agent agent = DQN_Agent(s_dim=1280, a_dim=10, epsilon_decay=0.99, epsilon_min=0.02, gamma=0.95, replay_batchsize=256) agent1 = DQN_Agent(s_dim=1280, a_dim=10, epsilon_decay=0.99, epsilon_min=0.02, gamma=0.95, replay_batchsize=256) agent2 = DQN_Agent(s_dim=1280, a_dim=10, epsilon_decay=0.99, epsilon_min=0.02, gamma=0.95, replay_batchsize=256) agent3 = DQN_Agent(s_dim=1280,