def __getitem__(self,index):
start = self.batch_size*index
end = min(start + self.batch_size,len(self.match) + len(self.unmatch))
size = end - start
assert size > 0
a = np.zeros((size,) + img_shape,dtype=K.floatx())
b = np.zeros((size,dtype=K.floatx())
c = np.zeros((size,1),dtype=K.floatx())
j = start//2
for i in range(0,size,2):
a[i,:,:] = read_for_training(self.match[j][0])
b[i,:] = read_for_training(self.match[j][1])
c[i,0 ] = 1 # This is a match
a[i+1,:] = read_for_training(self.unmatch[j][0])
b[i+1,:] = read_for_training(self.unmatch[j][1])
c[i+1,0 ] = 0 # Different whales
j += 1
return [a,b],c
这是Kaggle内核的一部分。此函数是kernel.util.sequence的一部分。我不太了解...有人可以给我一些提示吗?