Is Someone Speaking? Exploring Long-term Temporal Features for Audio-visual Active Speaker Detection

此博客主要介绍如何跑通此代码。
代码链接 : code
论文链接:paper

主要会出现的问题:

  1. 使用服务器下载数据集太慢,于是博主在windows系统写了同样的代码将数据集下载到本地(亲测下载速度比较快),如下:
import urllib.request
from tqdm import tqdm
with open('1.txt', 'r') as file:
    video_file_names = file.read().splitlines()
print(video_file_names)

output_directory = 'downloaded_videos'


import os

os.makedirs(output_directory, exist_ok=True)


for video_name in video_file_names:
    video_url = f"https://s3.amazonaws.com/ava-dataset/trainval/{video_name}"
    output_file = os.path.join(output_directory, video_name)

    try:
        # 使用 urllib.request.urlopen 打开链接
        with urllib.request.urlopen(video_url) as response, open(output_file, 'wb') as output_file:
            # 获取文件大小(字节)
            file_size = int(response.headers["Content-Length"])

            # 创建 tqdm 进度条
            progress_bar = tqdm(total=file_size, unit="B", unit_scale=True, desc=video_name)

            # 逐块下载并写入文件,同时更新进度条
            while True:
                data = response.read(1024)
                if not data:
                    break
                output_file.write(data)
                progress_bar.update(len(data))

            # 关闭进度条
            progress_bar.close()

        print(f"视频 '{video_name}' 已成功下载到 {output_file}")
    except Exception as e:
        print(f"下载视频 '{video_name}' 时出错: {e}")
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值