#NEWLINE# def ck_lm_series( datadir = None , align_to = 20 , labeled_only = False ) : #NEWLINE# #INDENT# '\n    Subset of Cohn-Kanade dataset with face landmark series as X\n    and labels as y\n    ' #NEWLINE# ck_dataset = CKDataset ( datadir ) #NEWLINE# X_lst = [ ] #NEWLINE# y_lst = [ ] #NEWLINE# for item in ck_dataset . data : #NEWLINE# #INDENT# landmarks = [ lm . flatten ( ) for lm in item . landmarks ] #NEWLINE# landmarks = interp_list ( landmarks , align_to ) #NEWLINE# lm_image = np . vstack ( landmarks ) #NEWLINE# X_lst . append ( lm_image . flatten ( ) ) #NEWLINE# y_lst . append ( item . label ) #NEWLINE# #UNINDENT# X = np . vstack ( X_lst ) #NEWLINE# y = np . array ( y_lst ) #NEWLINE# del ck_dataset #NEWLINE# if labeled_only : #NEWLINE# #INDENT# return ( X [ ( y != ( - 1 ) ) ] , y [ ( y != ( - 1 ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( X , y )