1 from __future__
import print_function
4 from keras.utils
import np_utils
9 sample_count = len(sample_ids)
10 batches =
int(sample_count/batch_size)
11 left_samples = sample_count%batch_size
14 for ids
in range(0, batches):
16 batch_ids = sample_ids[ids*batch_size:]
18 batch_ids = sample_ids[ids*batch_size:ids*batch_size+batch_size]
19 batch_ids = sorted(batch_ids)
21 X = data[
'data'][batch_ids]
22 Y = data[
'label'][batch_ids]
23 X1,X2 = X[:, [0]], X[:, [1]]
25 X1 = X1.reshape(X1.shape[0], 1, 100, 80).astype(
'float32')/255
26 X2 = X2.reshape(X2.shape[0], 1, 100, 80).astype(
'float32')/255
27 Y = np_utils.to_categorical(Y,5)
29 yield {
'input1':np.array(X1),
'input2':np.array(X2)} , {
'out':np.array(Y) }
def produce_seq(batch_size, data, sample_ids)