Action Prediction探索

项目从Action Recognition转向Action Prediction,因为后者能在行为未完全发生时进行识别,适合实时在线异常行为检测。研究了Human Interaction Prediction的两种方法,一种利用深度时序特征,另一种结合结构上下文模型和评分融合。这两种方法都结合了空间和时间信息来预测行为。

背景

由于项目组中有异常行为检测的项目,该项目需要对异常行为及时的报警,是real-time and online的检测。前期,项目研究了Action Recognition,而Recognition是对trimmed视频进行识别,而且是对发生完的动作进行识别,不适合项目的需求。而之后又探索了anomaly detection,这个是对异常事件的检测,但是异常事件检测采用重构的思想,即对正常行为进行训练,重构误差小,当一个没有见过的行为出现时,重构误差将会很大,用重构误差来判断一个行为是否属于异常事件,往往会出现误报警,即一个人突然快速走路也会判断为异常事件,不适合异常行为的场合。
因此,综合前面的探索,考虑到应用场景,因此把研究方向定到了Action Prediction。

Action Prediction定义:

根据论文SSNet: Scale Selection Network for Online 3D Action Prediction提及,Recognizing (predicting) an action before it is fully performed,即在行为没有全部发生时,便识别整个行为,这种操作就是行为预测。也称为early action recognition

调研

  1. Human Interaction Prediction Using Deep Temporal Features, ECCV2016.
    这里写图片描述

通过对视频帧提取opetical flow并且转换为彩图 ,根据不同的数据集合用不同的方式选取ROI 区域,即可以通过行人检测获得每个人的box, 并merge box获得ROI。输入ROI 区域并且通过CNN 建模,获得temporal features,并对行为进行分类。

解释一下class Agent: def __init__(self): self.n_games = 0 self.epsilon = 0 # randomness self.gamma = 0 # discount rate self.memory = deque(maxlen=MAX_MEMORY) # popleft() self.model = Linear_QNet(11, 256, 3) self.trainer = QTrainer(self.model, lr=LR, gamma=self.gamma) def get_state(self, snakegame): head = snakegame.snake[0] point_l = Point(head.x - 20, head.y) point_r = Point(head.x + 20, head.y) point_u = Point(head.x, head.y - 20) point_d = Point(head.x, head.y + 20) dir_l = snakegame.direction == Direction.LEFT dir_r = snakegame.direction == Direction.RIGHT dir_u = snakegame.direction == Direction.UP dir_d = snakegame.direction == Direction.DOWN state = [ # Danger straight (dir_r and snakegame.is_collision(point_r)) or (dir_l and snakegame.is_collision(point_l)) or (dir_u and snakegame.is_collision(point_u)) or (dir_d and snakegame.is_collision(point_d)), # Danger right (dir_u and snakegame.is_collision(point_u)) or (dir_d and snakegame.is_collision(point_d)) or (dir_l and snakegame.is_collision(point_l)) or (dir_r and snakegame.is_collision(point_r)), # Danger left (dir_d and snakegame.is_collision(point_d)) or (dir_u and snakegame.is_collision(point_u)) or (dir_r and snakegame.is_collision(point_r)) or (dir_l and snakegame.is_collision(point_l)), # Move direction dir_l, dir_r, dir_u, dir_d, #Food Location snakegame.food.x < snakegame.head.x, # food left snakegame.food.x > snakegame.head.x, # food right snakegame.food.y < snakegame.head.y, # food up snakegame.food.y > snakegame.head.y, # food down ] return np.array(state, dtype=int) def remember(self, state, action, reward, next_state, done): self.memory.append((state, action, reward, next_state, done)) #popleft if MAX_MEMORY is reached def train_long_memory(self): if len(self.memory) > BATCH_SIZE: mini_sample = random.sample(self.memory, BATCH_SIZE) #List of tuples else: mini_sample = self.memory states, actions, rewards, next_states, dones = zip(*mini_sample) self.trainer.train_step(states, actions, rewards, next_states, dones) # for state, action, reward, next_state, done in mini_sample: # self.trainer.train_step(state, action, reward, next_state, done) def train_short_memory(self, state, action, reward, next_state, done): self.trainer.train_step(state, action, reward, next_state, done) def get_action(self, state): # random moves: tradeoff eploration / exploitation self.epsilon = 80 - self.n_games final_move = [0, 0, 0] if random.randint(0, 200) < self.epsilon: move = random.randint(0, 2) final_move[move] = 1 else: state0 = torch.tensor(state, dtype=torch.float) prediction = self.model(state0) move = torch.argmax(prediction).item() final_move[move] = 1 return final_move
最新发布
03-20
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值