Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # hard sample mining?
- net = build_net()
- for i in range(NUM_ITERATIONS):
- anchors, positives, negatives = next(batch_generator)
- loss = net.evaluate([anchors, positives, negatives])
- loss_and_data = zip(loss, anchors, positives, negatives)
- loss_and_data = sorted(loss_and_data)
- batch_for_weight_update = loss_and_data[:batch_size]
- loss_hard, anchors_hard, positives_hard, negatives_hard = zip(*batch_for_weight_update)
- stuff = net.train_on_batch([anchors_hard, positives_hard, negatives_hard])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement