基本信息
N-UCLA骨架數據 raw data下載鏈接。
每個視頻都只有一個人。人身上設置了20個節點,如下圖所示:
N-UCLA骨架數據總共1484個樣本,平均時長39.4幀,最長的有201幀,最短的只有1幀(a02_s09_e04_v03.json和a02_s09_e04_v02.json)。
記樣本幀數為len:
0 < len < 10 ---> 10個樣本
10 <= len < 30 ---> 683個樣本
30 <= len < 50 ---> 445個樣本
50 <= len < 100 ---> 269個樣本
100 <= len < 150 ---> 65個樣本
150 <= len ---> 12個樣本
通常view1和view2作為training set,共1020個樣本。view3作為validation set。N-UCLA數據集總共包含10類動作,training set的各個動作的樣本數目如下:(i表示第幾類,count表示樣本數)
validation set的各個動作的樣本數目如下:
可視化程序
import numpy as np import sys import json import random import math import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D file_json = open(r'E:\CS\action_research\NW-UCLA\all_sqe\a01_s01_e00_v01.json', 'r') data_dict = json.load(file_json) data = np.array(data_dict['skeletons']) # shape (T, J, D). T: time step. J:joint. D:dimension. T, J, D = data.shape # 相鄰各節點列表,用來畫節點之間的連接線 hands = [7, 6, 5, 4, 2, 8, 9, 10, 11] legs = [15, 14, 13, 12, 0, 16, 17, 18, 19] trunk = [0, 1, 2, 3] # 3D展示------------------------------------------------------------------------ n = 0 # 從第n幀開始展示 m = T # 到第m幀結束,n<m<T fig = plt.figure() # 先生成一塊畫布,然后在畫布上添加3D坐標軸 plt.ion() for i in range(n, m): fig.clf() ax = Axes3D(fig, azim=-10, elev=5) ax.scatter(data[i, :, 0], data[i, :, 2], data[i, :, 1], c='red', s=40.0) ax.plot(data[i, hands, 0], data[i, hands, 2], data[i, hands, 1], c='green', lw=2.0) ax.plot(data[i, legs, 0], data[i, legs, 2], data[i, legs, 1], c='green', lw=2.0) ax.plot(data[i, trunk, 0], data[i, trunk, 2], data[i, trunk, 1], c='green', lw=2.0) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_xlim(-0.2, 0.4) ax.set_ylim(2.0, 3.2) ax.set_zlim(-1.0, 1.0) plt.pause(0.1) plt.ioff() plt.show()
效果: