Skip to content

Instantly share code, notes, and snippets.

View sunsided's full-sized avatar
🇺🇦
#StandWithUkraine

Markus Mayer sunsided

🇺🇦
#StandWithUkraine
View GitHub Profile
@sunsided
sunsided / load_jpeg_with_tensorflow.py
Created April 4, 2017 16:39 — forked from eerwitt/load_jpeg_with_tensorflow.py
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
@sunsided
sunsided / numpy_Capi
Created February 2, 2017 20:47 — forked from jjlin18/numpy_Capi
sample code for get and return numpy in C++
// From http://stackoverflow.com/questions/9128519/reading-many-values-from-numpy-c-api
/*
Make
g++ -o matrix_multiply.o -c matrix_multiply.cpp -I{python include file for numpy/noprefix.h} -I{python include} -fPIC -O2 -Wno-deprecated -Wno-write-strings
g++ -o matrix_multiply.so -shared matrix_multiply.o -L{boost lib path} -lz -lm -ldl -lpthread -boost_python
Python code:
import numpy
import matrix_multiply
@sunsided
sunsided / autoencoder.py
Created January 24, 2017 14:38 — forked from saliksyed/autoencoder.py
Tensorflow Auto-Encoder Implementation
""" Deep Auto-Encoder implementation
An auto-encoder works as follows:
Data of dimension k is reduced to a lower dimension j using a matrix multiplication:
softmax(W*x + b) = x'
where W is matrix from R^k --> R^j
A reconstruction matrix W' maps back from R^j --> R^k
@sunsided
sunsided / pca_alt_min.py
Created January 24, 2017 12:46 — forked from ahwillia/pca_alt_min.py
Alternating Minimization in Tensorflow (PCA example)
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@sunsided
sunsided / tensorflow_pca.py
Created January 24, 2017 12:46 — forked from ahwillia/tensorflow_pca.py
PCA in TensorFlow
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@sunsided
sunsided / memdjpeg.c
Created January 19, 2017 15:52 — forked from PhirePhly/memdjpeg.c
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@sunsided
sunsided / t-SNE Tutorial.ipynb
Created January 11, 2017 16:03 — forked from awjuliani/t-SNE Tutorial.ipynb
A notebook describing how to use t-SNE to visualize a neural network learn representations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sunsided
sunsided / FindSSE.cmake
Created September 13, 2016 11:56 — forked from hideo55/FindSSE.cmake
CMake module that detect SSE support
# Check if SSE instructions are available on the machine where
# the project is compiled.
MACRO (FindSSE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
STRING(REGEX REPLACE "^.*(sse2).*$" "¥¥1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
@sunsided
sunsided / readme.md
Created September 11, 2016 21:36 — forked from ishay2b/readme.md
Vanilla CNN caffe model
name caffemodel caffemodel_url license sha1 caffe_commit
Vanilla CNN Model
vanillaCNN.caffemodel
unrestricted
b5e34ce75d078025e07452cb47e65d198fe27912
9c9f94e18a8909580a6b94c44dbb1e46f0ee8eb8

Implementation of the Vanilla CNN described in the paper: Yue Wu and Tal Hassner, "Facial Landmark Detection with Tweaked Convolutional Neural Networks", arXiv preprint arXiv:1511.04031, 12 Nov. 2015. See project page for more information about this project.