Skip to content

Instantly share code, notes, and snippets.

View johnhany's full-sized avatar
🌴
On vacation

John Hany johnhany

🌴
On vacation
  • Writing a New Book
  • Beijing, China
View GitHub Profile
@johnhany
johnhany / mnist-convnet-lenet-visualize.py
Created September 25, 2017 14:01
A demo for MNIST LeNet model for TensorFlow, including exporting model and visualization.
import os
import tensorflow as tf
LOGDIR = 'visualize/'
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("F:\\Datasets\\AorB\\mnist\\", one_hot=True)
def conv_layer(input, size_in, size_out, name="conv"):
with tf.name_scope(name):
@johnhany
johnhany / KNN.cpp
Created August 6, 2017 11:28
KNN on MNIST with OpenCV
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
#define PIXELS_IN_IMAGE 28*28
#define ENABLE_TRAIN 1
@johnhany
johnhany / SVM.cpp
Created August 6, 2017 11:28
SVM on MNIST with OpenCV
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
#define PIXELS_IN_IMAGE 28*28
#define ENABLE_TRAIN 1