Skip to content

Instantly share code, notes, and snippets.

View OliverEdholm's full-sized avatar

Oliver Edholm OliverEdholm

View GitHub Profile
@duhaime
duhaime / measure_img_similarity.py
Last active March 1, 2023 08:41
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
# This file is useful for reading the contents of the ops generated by ruby.
# You can read any graph defination in pb/pbtxt format generated by ruby
# or by python and then convert it back and forth from human readable to binary format.
import tensorflow as tf
from google.protobuf import text_format
from tensorflow.python.platform import gfile
def pbtxt_to_graphdef(filename):
with open(filename, 'r') as f:
@shapr
shapr / dbexport.py
Created May 27, 2014 16:27
Jython: use Jackcess to csv export all the tables from whatever Jackcess supports, including Access 97, 2000, 2003, 2007, 2010
# required apt-get install jython libcommons-logging-java libcommons-lang-java
import sys
sys.path.append('jackcess-2.0.4.jar') # assume the jackcess is in the same directory
sys.path.append('/usr/share/java/commons-logging-1.1.3.jar') # in case logging didn't get picked up
sys.path.append('/usr/share/java/commons-lang-2.6.jar') # in case lang didn't get picked up
from com.healthmarketscience.jackcess import *
from com.healthmarketscience.jackcess.util import ExportFilter
from com.healthmarketscience.jackcess.util import ExportUtil
from com.healthmarketscience.jackcess.util import SimpleExportFilter
import java.io