深度图和IR(红外)视频的分辨率均为512x424,
3D骨骼数据包含每帧25个人体关节的3D坐标。
每个数据集由三台Kinect V2摄像机同时捕获。
原文名称
NTU RGB+D 120: A Large-Scale Benchmark for 3D Human Activity Understanding
处理之后的效果如下图所示

原文中的两种划分方式

在运行代码之前需要自己弄懂代码,修改对应文件的文件的目录。否则将自己的文件弄乱了很麻烦。
Cross-Subject Evaluation 划分训练集和测试集
import os import shutil # 我的开始目录为data/ntu_rgb_d/nturgbd_rgb_s001/nturgb+d_rgb #data/ntu_rgb_d/nturgbd_rgb_s002/nturgb+d_rgb #... #data/ntu_rgb_d/nturgbd_rgb_s032/nturgb+d_rgb dataset = 'test' #此处为划分出test数据集。划分出train数据集,只需修改为train再一次运行。 path = "data/ntu_rgb_d/" # 总的文件路径 nturgb = 'nturgb+d_rgb' dirs = os.listdir(path) for file in dirs: #循环每一个目录中的每一个文件 file_path = path + file + '/' + nturgb #到达具有视频的文件目录之下 file = os.listdir(file_path) for video_id in file: #循环每一个每一个文件中的每一个视频名字 person_id = int(video_id.split('P')[1][:3]) # 以扩展名为名称的子文件夹 person_id_training = [1, 2, 4, 5, 8, 9, 13, 14, 15, 16, 17, 18, 19, 25, 27, 28, 31, 34, 35, 38, 45, 46, 47, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 70, 74, 78, 80, 81, 82, 83, 84, 85, 86, 89, 91, 92, 93, 94, 95, 97, 98, 100, 103] if dataset == 'train': person_id_to_keep = person_id_training else: person_id_to_keep = list(range(1, 107)) person_id_to_keep = [p for p in person_id_to_keep if p not in person_id_training] if person_id in person_id_to_keep : folder_name = "data/NTU_RGB/" + dataset f = file_path + '/' + video_id # 如果不存在该目录,先创建,再移动文件 if not os.path.exists(folder_name): os.makedirs(folder_name) shutil.move(f, folder_name) else: shutil.move(f, folder_name)
讯享网
Cross-Subject Evaluation 生成标签文件
讯享网import os import shutil path = "data/NTU_RGB/test/" dirs = os.listdir(path) train_videos = "data/NTU_RGB/test_videos.txt" for video_id in dirs: with open(train_videos, 'a+') as f: f.writelines(video_id + ' ') action_id = int(video_id.split('A')[1][:3]) - 1 action_id = str(action_id) with open(train_videos, 'a+') as f: f.writelines(action_id + '\n')
Cross-Setup Evaluation划分训练集和测试集
import os import shutil #划分为训练集和测试集 dataset = 'test' path = "data/NTU_RGB_CS2/" nturgb = 'nturgb+d_rgb' dirs = os.listdir(path) for file in dirs: file_path = path + file + '/' + nturgb file = os.listdir(file_path) for video_id in file: S_id = int(video_id.split('P')[1][:3]) # 以扩展名为名称的子文件夹 S_id_testing = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105] if dataset == 'test': S_id_to_keep = S_id_testing else: S_id_to_keep = list(range(1, 107)) S_id_to_keep = [p for p in S_id_to_keep if p not in S_id_testing] if S_id in S_id_to_keep : folder_name = "data/NTU_RGB2/" + dataset f = file_path + '/' + video_id # 如果不存在该目录,先创建,再移动文件 if not os.path.exists(folder_name): os.makedirs(folder_name) # 举例:这里的f为 1.png 等同于 ./1.png (因为是相对路径) shutil.move(f, folder_name) # 直接移动文件 else: shutil.move(f, folder_name)
Cross-Setup Evaluation 以及生成标签文件
讯享网#生成标签文件 path = "data/NTU_RGB2/train/" dirs = os.listdir(path) train_videos = "data/NTU_RGB2/train_videos.txt" for video_id in dirs: with open(train_videos, 'a+') as f: f.writelines(video_id + ' ') action_id = int(video_id.split('A')[1][:3]) - 1 action_id = str(action_id) with open(train_videos, 'a+') as f: f.writelines(action_id + '\n')

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/18305.html