This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iterate_minibatches(inputs, targets, batchsize, shuffle=False): | |
assert len(inputs) == len(targets) | |
while True: | |
if shuffle: | |
indices = np.arange(len(inputs)) | |
np.random.shuffle(indices) | |
for start_idx in range(0, len(inputs) - batchsize + 1, batchsize): | |
if shuffle: | |
excerpt = indices[start_idx:start_idx + batchsize] | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
train on seq_of_iamges vs seq_of_images -> {0,1} sigmoid or contrastive_loss | |
""" | |
# model.load_weights("checkpoint_model.h5") | |
def euclidean_distance(vects): | |
x, y = vects | |
return K.sqrt(K.sum(K.square(x - y), axis=1, keepdims=True)) |