行为识别模型action-recognition-master解读

本文详细解读了使用AlexNet与LSTM结合的深度学习模型进行行为识别的方法。首先,通过dataset.py下载HMDB51数据集。接着在model.py中,初始化模型参数,对预训练的AlexNet提取特征层,固定其参数不参与梯度计算。然后,构建LSTM层,定义输入特征维数、隐藏层状态维数和堆叠层数。最后,通过全连接层完成分类任务,模型命名为'alexnet_lstm'。
摘要由CSDN通过智能技术生成

1.dataset.py

用于下载需要使用的数据集hmdb51:

import requests
import os
import glob

def download_file(URL, destination):
    session = requests.Session()
    response = session.get(URL, stream = True)

    save_response_content(response, destination)    


def save_response_content(response, destination):
    CHUNK_SIZE = 32768

    with open(destination, "wb") as f:
        for chunk in response.iter_content(CHUNK_SIZE):
            if chunk: # filter out keep-alive new chunks
                f.write(chunk)


print('Downloading dataset...')
if not os.path.isfile('data/hmdb51_org.rar'):
    download_file('http://serre-lab.clps.brown.edu/wp-content/uploads/2013/10/hmdb51_org.rar', 'data/hmdb51_org.rar')

if not os.path.isdir('data/video'):
    os.makedirs('data/video')
    
os.system('unrar e data/hmdb51_org.rar data/video')

filenames = glob.glob('data/video/*.rar')
for fil
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值