Skip to content

Instantly share code, notes, and snippets.

@vrxacs
vrxacs / tfModelLoading.js
Last active October 26, 2018 22:21
Loading a TensorFlow.js model and doing classification
var wait = ms => new Promise((r, j)=>setTimeout(r, ms));
async function main() {
const model = await tf.loadModel('./model/model.json');
document.getElementById('image_upload').onchange = function(ev) {
var f = ev.target.files[0];
var fr = new FileReader();
var makePrediction = async function(img) {
@vrxacs
vrxacs / simplemodel.py
Created October 26, 2018 05:02
Simple image classification architecture
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=input_shape))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(32, (3, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(64, (3, 3)))