Skip to content

Instantly share code, notes, and snippets.

@zygmuntz
zygmuntz / mnist_siamese_graph_mod.py
Last active May 1, 2020 19:20
A Siamese network example modified to use weighted L1 distance and cross-entropy loss.
#!/usr/bin/env python
"""
A Siamese network example modified to use weighted L1 distance and cross-entropy loss, as in
Siamese Neural Networks for One-shot Image Recognition
http://www.cs.toronto.edu/~rsalakhu/papers/oneshot1.pdf
"""
@datlife
datlife / mnist_tfdata.py
Last active May 24, 2023 02:03
Training Keras model with tf.data
"""An example of how to use tf.Dataset in Keras Model"""
import tensorflow as tf # only work from tensorflow==1.9.0-rc1 and after
_EPOCHS = 5
_NUM_CLASSES = 10
_BATCH_SIZE = 128
def training_pipeline():
# #############
# Load Dataset