Skip to content

Instantly share code, notes, and snippets.

@zoonono
zoonono / nottineye.py
Created September 26, 2018 10:52 — forked from Cairnarvon/nottineye.py
Tineye-style image search, locally. Everyone's a winner. (Requires PIL. --help for usage.)
#!/usr/bin/python
import glob
import math
import os
import getopt
import sys
from PIL import Image
@zoonono
zoonono / kdd99exp.py
Created June 18, 2017 05:44 — forked from charanpald/kdd99exp.py
KDD CUP 99 Intrusion Detection Code
import pandas
import numpy
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import confusion_matrix, zero_one_loss
# Must declare data_dir as the directory of training and test files
train_data = data_dir + "kddcup.data.corrected"
train_labels = data_dir + "train_labels.txt"
test_data = data_dir + "corrected"
import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
# Define custom py_func which takes also a grad op as argument:
def py_func(func, inp, Tout, stateful=True, name=None, grad=None):
# Need to generate a unique name to avoid duplicates:
rnd_name = 'PyFuncGrad' + str(np.random.randint(0, 1E+8))
@zoonono
zoonono / autoencoder.py
Created March 21, 2017 05:01 — forked from gabrieleangeletti/autoencoder.py
Denoising Autoencoder implementation using TensorFlow.
import tensorflow as tf
import numpy as np
import os
import zconfig
import utils
class DenoisingAutoencoder(object):
""" Implementation of Denoising Autoencoders using TensorFlow.
@zoonono
zoonono / install_caffe_pyenv.md
Created March 14, 2017 20:51 — forked from alexlee-gk/install_caffe_pyenv.md
Install caffe with python 3.5 and pyenv

Install caffe with python 3.5 and pyenv

Tested on Ubuntu 14.04.

Setting up a new python environment using pyenv

Install desired version of python 3 (e.g. 3.5.1). Make sure to use the --enable-shared flag to generate python shared libraries, which will later be linked to.

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.5.1