Skip to content

Instantly share code, notes, and snippets.

@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
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
import skimage
import skimage.io as skio
import os
from os import path
@mstankie
mstankie / import-plt.py
Created June 15, 2016 19:33
Two images side-by-side using matplotlib (pylab)
import matplotlib.pyplot as plt
@psycharo-zz
psycharo-zz / read_seq.py
Created May 15, 2014 16:11
reading .seq files from caltech pedestrian dataset
def read_seq(path):
def read_header(ifile):
feed = ifile.read(4)
norpix = ifile.read(24)
version = struct.unpack('@i', ifile.read(4))
length = struct.unpack('@i', ifile.read(4))
assert(length != 1024)
descr = ifile.read(512)
params = [struct.unpack('@i', ifile.read(4))[0] for i in range(0,9)]