コード例 #1
0
    # Collapse strided so that it has one more dimension than the window.  I.e.,
    # the new array is a flat list of slices.
    meat = len(ws) if ws.shape else 0
    firstdim = (np.product(newshape[:-meat]), ) if ws.shape else ()
    dim = firstdim + (newshape[-meat:])
    return strided.reshape(dim)


#(X_train, y_train), (X_test, y_test) = full_bpm_to_data(get_interesting_heartrates(HEART_AV_ROOT))

ns = NormalizedSubjectSplitSpectrograms(
    subjectIdependant=True)  #NormalizedSpectrograms()

#ns = NormalizedSubjectSplitSpectrograms(subjectIdependant=False)#NormalizedSpectrograms()
ns = NormalizedSpectrograms(getVideoSpectrograms())

X_train, Y_train = ns.getTrainData()
print(X_train.shape)
ws = np.array(X_train.shape)
ss = np.array(X_train.shape)
ws = (1, 1, 200, 50)
ss = (1, 1, 200, 5)
X_train = sliding_window(X_train, ws, ss, True)
X_train = X_train[:, 0, :, :, :]
X_val, Y_val = ns.getValidationData()
X_val = X_val[:, :, :, 0:50]

repeat_cnt = 4
Y_train = repeat_n_times(Y_train, repeat_cnt)
Y_train = np.repeat(Y_train, X_train.shape[0] // Y_train.shape[0], axis=0)