This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class N_Tuple_Classifier_fast(object): | |
def __init__(self, pixel_percentage=0.1, num_tuples=100, pixel_tolerance=0.3, warm_start=None): | |
''' pixel_percentage: The percentage of pixels on to which we'll | |
For example the default 0.1 randomly choose 78 pixels. | |
num_tuples: Number of unique tuples on to which project. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numpy import random as rnd | |
import cv2 | |
def gen_data(N=100, L=8, NData=160, NRows=1, Label_Hsize=50, Label_sigma=7, | |
Noise_sigma=4): | |
Label_Hsize += (1 - (Label_Hsize % 2 )) # cv2 Gaussian filter requires odd dimensions | |
Labels = np.zeros((NData, N)) | |
Features = np.zeros((NData, NRows, N, L)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Most of these algorithms are derived from psuedocode in Cormen et. al. | |
inf = float('inf') | |
class Vertex(object): | |
""" Adjacent list implementation of a graph. Create a vertex (v) and then its adjacent edges are stored | |
in the list v.edges. A graph will then just be a set of vertex objects. Can use this to implement | |
directed/undirected and weighted/unweighted graphs easily.""" | |
def __init__(self, adj=[]): |