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
def fib_bottom_up(n): | |
if n == 1 or n == 2: | |
return 1 | |
bottom_up = [None] * (n+1) | |
bottom_up[1] = 1 | |
bottom_up[2] = 1 | |
for i in range(3, n+1): | |
bottom_up[i] = bottom_up[i-1] + bottom_up[i-2] | |
return bottom_up[n] |
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 | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
def smooth(y, box_pts): | |
box_pts = max(box_pts, 1) if len(y) > box_pts else 1 | |
box = np.ones(box_pts)/box_pts | |
y_smooth = np.convolve(y, box, mode='valid') | |
return y_smooth |
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 torch | |
from torchvision import transforms | |
import cv2 | |
import numpy as np | |
import types | |
from numpy import random | |
def intersect(box_a, box_b): | |
max_xy = np.minimum(box_a[:, 2:], box_b[2:]) |
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 tensorflow as tf | |
from tensorflow.python.platform import gfile | |
with tf.Session() as sess: | |
model_filename ='PATH_TO_PB.pb' | |
with gfile.FastGFile(model_filename, 'rb') as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
g_in = tf.import_graph_def(graph_def) | |
LOGDIR='/logs/tests/1/' | |
train_writer = tf.summary.FileWriter(LOGDIR) |