def __init__(self): self._image = None self._angle = (0.0, 0.0) self._reward = 0.0 self._done = False self._action = None self.timing = brica.Timing(0, 1, 0)
def __init__(self): self.timing = brica.Timing(2, 1, 0) self.optical_flow = OpticalFlow() self.last_saliency_map = None self.last_optical_flow = None
def __init__(self): self.timing = brica.Timing(2, 1, 0) # Allocentric panel map image self.map_image = np.zeros((128, 128, 3), dtype=np.uint8) # Allocentric panel map image self.not_overlaid_map_image = np.zeros((128, 128, 3), dtype=np.uint8) # blured Allocentric panel map image self.blured_map_image = np.zeros((128, 128, 3), dtype=np.uint8) # copied from retina.py width = 128 self.blur_rates, self.inv_blur_rates = self._create_rate_datas( width, sigma=0.48, clipping_gain=1.8, gain=1.0 ) # original param are sigma=0.32, clipping_gain=1.2, gain=1.0 self.inv_blur_rates += 0.2 self.inv_blur_rates = np.clip(self.inv_blur_rates, 0.0, 1.0) self.blur_rates = 1.0 - self.inv_blur_rates self.gray_rates, self.inv_gray_rates = self._create_rate_datas( width, gain=0.5) self.inv_gray_rates += 0.6 self.inv_gray_rates = np.clip(self.inv_gray_rates, 0.0, 1.0) self.gray_rates = 1.0 - self.inv_gray_rates
def __init__(self): self.timing = brica.Timing(4, 1, 0) self.saliency_accumulators = [] self.cursor_accumulators = [] self.potentialMap = [] cursor_template = load_image("data/debug_cursor_template_w.png") for ix in range(GRID_DIVISION): pixel_x = GRID_WIDTH * ix cx = 2.0 / GRID_DIVISION * (ix + 0.5) - 1.0 for iy in range(GRID_DIVISION): pixel_y = GRID_WIDTH * iy cy = 2.0 / GRID_DIVISION * (iy + 0.5) - 1.0 ex = -cx ey = -cy saliency_accumulator = SaliencyAccumulator( pixel_x, pixel_y, ex, ey) self.saliency_accumulators.append(saliency_accumulator) cursor_accumulator = CursorAccumulator(pixel_x, pixel_y, ex, ey, cursor_template) self.cursor_accumulators.append(cursor_accumulator)
def __init__(self): self.timing = brica.Timing(5, 1, 0) self.bgrl = BGRL() self.gamma = 0.99 self.eps = np.finfo(np.float32).eps.item() self.log_prob = None self.value = None
def __init__(self): self.timing = brica.Timing(1, 1, 0) width = 128 self.blur_rates, self.inv_blur_rates = self._create_rate_datas(width) self.gray_rates, self.inv_gray_rates = self._create_rate_datas(width, gain=0.5) self.last_retina_image = None
def __init__(self): self.timing = brica.Timing(2, 1, 0) # Allocantric panel map image self.map_image = np.zeros((128, 128, 3), dtype=np.uint8) # buffer for latents (7, 6, 8) (buffer_len, tasks, features) lat_buffers = {k: np.zeros(8) for k in MODEL_PATHS.keys()} self.latents_buffer = deque([lat_buffers] * 7)
def __init__(self): self._image = None self._angle = (0.0, 0.0) # add phase #self._phase = 'True' self._reward = 0.0 self._done = False self._action = None self.timing = brica.Timing(0, 1, 0)
def __init__(self): self.timing = brica.Timing(3, 1, 0) self.cursor_find_accmulator = CursorFindAccumulator() self.phase = Phase.INIT self.buffer_size = 10 self.pixel_size = 21 self.value_size = 1 self.pre_reward = 0 self.buffer_index = 0 self.episode_buffer_List_index = 0 self.map_image = np.zeros((128, 128, 3), dtype=np.uint8) self.image_dim = 128 self.feature_threshold = 0.2 self.episode_index = 0 self.pre_reward = 0 self.BefferStock_decay_rate = 0.9 self.episode = None self.Grid_size = 16 self.potentialMap_8shape = np.ones((8, 8)) self.valueMap = np.zeros((8, 8), dtype=np.float32) self.feature_list = [ np.zeros((self.image_dim * self.image_dim), dtype=np.float32), np.zeros((self.image_dim * self.image_dim), dtype=np.uint8), np.zeros((self.image_dim * self.image_dim), dtype=np.uint8) ] self.feature = [ np.zeros((self.pixel_size, self.pixel_size), dtype=np.float32) ] self.episode_buffer = [ np.zeros((self.buffer_size, self.pixel_size * self.pixel_size), dtype=np.float32), np.zeros((self.buffer_size, self.value_size), dtype=np.float32) ] self.episode_buffer_stock = [ np.zeros((self.buffer_size, self.pixel_size * self.pixel_size), dtype=np.float32), np.zeros((self.buffer_size, self.value_size), dtype=np.float32) ] self.potentialMap = [ np.zeros((1, self.image_dim // 2), dtype=np.float32) ] self.allocentric_Grid = [np.zeros((8, 8), dtype=np.float32)] self.Normalization = [np.zeros((8, 8), dtype=np.float32)] self.Normalization_Ones = [np.ones((8, 8), dtype=np.uint8)]
def __init__(self, model_name=None, skip=False, use_saved_models=False): self.timing = brica.Timing(5, 1, 0) self.step = 0 self.model_name = model_name self.use_saved_models = use_saved_models if model_name is not None: print('loading model: {}'.format(model_name)) if not skip: self.__initialize_rl() self.last_bg_data = None
def __init__(self): self.timing = brica.Timing(3, 1, 0) self.cursor_find_accmulator = CursorFindAccumulator() self.phase = Phase.INIT self.mapbuff = [] now = time.ctime() self.cnvtime = time.strptime(now) self.curphase = 'True'
def __init__(self, training=True, init_weight_path=None, use_cuda=False): self.timing = brica.Timing(5, 1, 0) self.training = training self.total_steps = 0 self.ep_rewards = [0.] self.cuda = use_cuda self.ac_model = ACModel() self.ac_model.load_state_dict(torch.load(init_weight_path)) self.optimizer = optim.Adam(self.ac_model.parameters(), lr=lr) if self.cuda: self.ac_model = self.ac_model.cuda() self.init_params()
def __init__(self): self.timing = brica.Timing(3, 1, 0) self.vae_cursor_accumulator = Abam(len(MODEL_PATHS.keys())) # replace cursor_find_accmulator with vae error accumulator # if vae is not consistently reliable, the scene is finding cursor self.vae_error_accumulators = {} for name in MODEL_PATHS.keys(): self.vae_error_accumulators[name] = Accumulator() self.phase = Phase.INIT self.prev_phase = self.phase self.last_current_task = None
def __init__(self, logger=None, log_path=None, train=True): self.timing = brica.Timing(5, 1, 0) self.log_path = log_path self.train = train self.buffer_s, self.buffer_a, self.buffer_r = [], [], [] self.steps = 1 self.a = [] self.reward = 0 #self.now = time.ctime() #self.cnvtime = time.strptime(self.now) self.sess = tf.Session() Brain('global', self.sess) self.worker = Agent(1, self.sess) self.saver = tf.train.Saver(max_to_keep=None) self.sess.run(tf.global_variables_initializer())
def __init__(self): self.timing = brica.Timing(5, 1, 0) #plt.ion() self.buffer_s, self.buffer_a, self.buffer_r = [], [], [] self.total_r = [] self.avg_epoch_r_hist = [] self.steps = 1 self.a = [] self.sess = tf.Session() with tf.device("/cpu:0"): #env = Environment(fef_data, action_space) Brain('global', self.sess) #env = Environment(fef_data, action_space) self.worker = Agent(1, self.sess) self.sess.run(tf.global_variables_initializer())
def __init__(self): self.timing = brica.Timing(6, 1, 0) self.last_fef_data = None self.action = None self.data_size = 128 self.likelihood_over_threshold = [ np.zeros(self.data_size), np.zeros(self.data_size), np.zeros(self.data_size) ] self.likelihood_under_threshold = [ np.zeros(self.data_size), np.zeros(self.data_size), np.zeros(self.data_size) ]
def __init__(self, gpuid=-1, alpha=0.5, gamma=0.95, train=True, backprop=True): self.timing = brica.Timing(5, 1, 0) self.agent = self._set_agent(gpuid=gpuid) self.reward = 0 self.time = 0 if gpuid < 0: self.xp = numpy else: print("Use GPU") cuda.get_device(gpuid).use() self.xp = cuda.cupy chainer.config.train = train chainer.config.enable_backprop = backprop
def __init__(self): self.timing = brica.Timing(4, 1, 0) self.saliency_accumulators = [] self.cursor_accumulators = [] cursor_template = load_image("data/debug_cursor_template_w.png") for ix in range(GRID_DIVISION): pixel_x = GRID_WIDTH * ix cx = 2.0 / GRID_DIVISION * (ix + 0.5) - 1.0 for iy in range(GRID_DIVISION): pixel_y = GRID_WIDTH * iy cy = 2.0 / GRID_DIVISION * (iy + 0.5) - 1.0 ex = -cx ey = -cy saliency_accumulator = SaliencyAccumulator(pixel_x, pixel_y, ex, ey) self.saliency_accumulators.append(saliency_accumulator) cursor_accumulator = CursorAccumulator(pixel_x, pixel_y, ex, ey, cursor_template) self.cursor_accumulators.append(cursor_accumulator) arg_parser = common_arg_parser() args, unknown_args = arg_parser.parse_known_args() args.alg = 'a2c' args.env = 'PointToTarget-v0' args.network = 'cnn' args.num_timesteps = 0 args.play = True extra_args = parse_cmdline_kwargs(unknown_args) self.model, env = train(args, []) self.model.load(LOAD_PATH) env.close() self.actions = ACTION_RATE * ACTION_DIRECTIONS
def __init__(self): self.timing = brica.Timing(4, 1, 0) self.saliency_accumulators = [] self.error_accumulators = [] self.cursor_accumulators = [] self.background_accumulators = [] cursor_template = load_image("data/debug_cursor_template_w.png") # devide and create accumulators for each region for ix in range(GRID_DIVISION): pixel_x = GRID_WIDTH * ix cx = 2.0 / GRID_DIVISION * (ix + 0.5) - 1.0 for iy in range(GRID_DIVISION): pixel_y = GRID_WIDTH * iy cy = 2.0 / GRID_DIVISION * (iy + 0.5) - 1.0 ex = -cx ey = -cy # accumulators shape (GRID_DIVISION**2, ) * 2 saliency_accumulator = SaliencyAccumulator( pixel_x, pixel_y, ex, ey) self.saliency_accumulators.append(saliency_accumulator) # cursor accumulater cursor_accumulator = CursorAccumulator(pixel_x, pixel_y, ex, ey, cursor_template) self.cursor_accumulators.append(cursor_accumulator) # vae error accumulator error_accumulator = SaliencyAccumulator( pixel_x, pixel_y, ex, ey) self.error_accumulators.append(error_accumulator) # background accumulator background_accumulator = BackgroundAccumulator( pixel_x, pixel_y, ex, ey) self.background_accumulators.append(background_accumulator)
def __init__(self): self.timing = brica.Timing(5, 1, 0) self.reward = 0
def __init__(self): self.timing = brica.Timing(6, 1, 0) self.last_fef_data = None
def __init__(self): self.timing = brica.Timing(2, 1, 0) # Allocantric panel map image self.map_image = np.zeros((128, 128, 3), dtype=np.uint8)
def __init__(self): self.timing = brica.Timing(3, 1, 0) self.cursor_find_accmulator = CursorFindAccumulator() self.phase = Phase.INIT
def __init__(self): self.timing = brica.Timing(2, 1, 0)