analyze
compare_sequences_pairwise
compare_sequences_pairwise (seq1, seq2, figure_type='figures')
member_frame_movements
member_frame_movements (movement_series, poses_series, max_clip=3, show=False, condense=True)
For a multi-dancer video, generate individual inter-frame movement series for all of the dancers and plot them.
average_frame_movements
average_frame_movements (movement_series, poses_series, show=False, max_clip=3, video_file=None)
Compute the average and stdv of the inter-frame movement for each frame of a pose sequence with >= 1 dancers. Assumes movement_series is an array of inter-frame movement values, one for each detected pose, with missing poses identified via np.nan, as generated from process_movement_series.
plot_interpose_similarity
plot_interpose_similarity (pose_series, frame_means, frame_stdevs, video_file, show=False, min_clip=0.2)
For multi-pose videos
compare_multiple
compare_multiple (pose_data, method='distance', figure_type='aligned_figures')
For multi-dancer videos: Get the mean and standard deviation of inter-pose similarities for each frame
condense_labels
condense_labels (labels, cluster_map)
Can be used to “collapse” clusters of similar poses into meta-clusters
compute_pose_distribution
compute_pose_distribution (poses_series, labels, descriptors, figure_type='zeroified_figures', cluster_averages=None)
Assign non-clustered poses to clusters (can take a long time) and generate a clustering timeline heatmap of the pose occurrences.
render_pose_distribution
render_pose_distribution (heatmap, poses_series, labels, descriptors, closest_matches=None, show=True, video_file=None, time_index=None, cell_height=120, xlim=None)
Draw a pose cluster timeline based on a precomputed clustering and assigment of non-clustered poses to clusters via compute_pose_distribution() below. Passing in the heatmap from the previous step saves a lot of time.
find_nearest_pose
find_nearest_pose (pose_matrix, cluster_averages)
get_cluster_averages_and_indices
get_cluster_averages_and_indices (labels, descriptors, pose_series, figure_type='figures', video_file=None, flip_figures=False)
Average the members of each pose cluster to get the representative “average” pose for the cluster.
cluster_poses
cluster_poses (poses_series, figure_type='aligned_figures', min_samples=50)
get_feature_vectors
get_feature_vectors (pose_series, figure_type='aligned_figures', method='distance')
average_poses
average_poses (pose_series, descriptors, source_figures='zeroified_figures', flip=True)
process_movement_series
process_movement_series (pose_data, pose_index=-1, figure_type='flipped_figures', video_file=None, method='distance', interpolate=True, viz=True)
Smooth, summarize, visualize movement data for one or more figures across a time series. Also visualize aggregate movement data for each keypoint, if distance matrix method is used.
movements_time_series
movements_time_series (pose_data, pose_index=-1, method='distance', figure_type='flipped_figures', video_file=None)
Calculate a time series of the differences between each pair of poses in a sequence. This works with a single figure (pose_index=0) or all the figures in the video (pose_index=-1). It can be run on its own, but typically this is a helper function for process_movement_series() (below).
fill_nans_scipy1
fill_nans_scipy1 (padata, pkind='linear')
Fill in missing values from a time series, after the first non-NAN value and up to the last non-NAN value. Note that scipy.interpolated.interp1d provides a lot more options (splines, quadratic, etc.)
correlate_time_series
correlate_time_series (pose_data1, pose_data2, method='correlate', figure_type='figures')
corr_time_series_matrix
corr_time_series_matrix (pose_data, method='distance')
Generate a full time-series pose similarity heatmap for all available poses and frames from the video. This code can use either pose characterization approach; in practice, the distance matrix-based analyses take longer to calculate but are more accurate.
smooth_series
smooth_series (x, window_len=11, window='flat')
Smooth a time series via a sliding window average From https://scipy-cookbook.readthedocs.io/items/SignalSmooth.html