This file contains 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
from keras.models import Sequential, Model | |
from keras.layers import Dense, Input, BatchNormalization as BN | |
input_img1 = Input(shape=(4,), name="input_img1") | |
vision_model = Sequential() | |
vision_model.add(Dense(4, input_shape=(4,))) | |
vision_model.add(BN(axis=1)) | |
vision_model.add(Dense(4)) |
This file contains 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
#!/usr/bin/env python | |
def msg(x): | |
print "S:",x.encode("hex") | |
if len(x) <= 7: | |
ret = chr(len(x)) + x | |
else: | |
assert False | |
return ret.ljust(8, "\x00") | |
def isotp_send(panda, x, addr, bus=0): |
This file contains 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
real_colors = [[115,82,68],[194,150,130],[98,122,157],[87,108,67],[133,128,177],[103,189,170],[214,126,44],[80,91,166],[193,90,99],[94,60,108],[157,188,64],[224,163,46],[56,61,150],[70,148,73],[175,54,60],[231,199,31],[187,86,149],[8,133,161],[243,243,242],[200,200,200],[160,160,160],[122,122,121],[85,85,85],[52,52,52]] |
This file contains 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
# homogenous line from two points (this isn't on the internet...) | |
line = [0,0,0] | |
line[0] = (f1[1] - f2[1]) * (f1[1] * f2[0] - f1[0] * f2[1]) | |
line[1] = (f1[0] - f2[0]) * (f1[0] * f2[1] - f1[1] * f2[0]) | |
line[2] = (f1[0] * f2[1] - f1[1] * f2[0]) * (f1[1] * f2[0] - f1[0] * f2[1]) | |
line = np.array(line) | |
# line intersection (https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Using_homogeneous_coordinates) | |
p = np.array([l1[1] * l2[2] - l2[1] * l1[2], l2[0] * l1[2] - l1[0] * l2[2], l1[0] * l2[1] - l2[0] * l1[1]]) | |
p /= p[2] |
This file contains 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
guess = np.concatenate([np.array(map(lambda x: np.array(x[:,3]).ravel(), rts)), fpts[:, 0:3]], axis=0) | |
selects = [] | |
xys = [] | |
for i, trk in enumerate(good_good_tracks): | |
for shot, kp in trk: | |
xy = G.node[(shot,kp)]['kp']/0.81412059 | |
xys.append(xy) | |
select = np.zeros((len(frms)+len(good_good_tracks),)) | |
select[shot] = 1 | |
select[len(frms)+i] = 1 |
This file contains 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
#!/usr/bin/env python | |
import os | |
import sys | |
import argparse | |
import zmq | |
import json | |
import cv2 | |
import numpy as np | |
from hexdump import hexdump | |
import scipy.misc |
This file contains 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 getFundamentalMatrix(pts1, pts2): | |
vvec = [] | |
for p1, p2 in zip(pts1, pts2): | |
vvec.append([p2[0] * p1[0], p2[0] * p1[1], p2[0], p2[1] * p1[0], p2[1] * p1[1], p2[1], p1[0], p1[1], 1]) | |
vvec = np.array(vvec) | |
U, S, Vt = np.linalg.svd(vvec) | |
Fvl = Vt[-1] | |
om = Fvl.reshape(3,3) |
This file contains 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
d4::pa_ax3 |- = x + x 0 | |
d5::ax-1 |- implies | |
= x + x 0 | |
implies = y + y 0 = x + x 0 | |
d3:d4,d5:ax-mp |- implies = y + y 0 = x + x 0 | |
3:d3:alpha_2 |- implies = y + y 0 forall x = x + x 0 | |
d6::pa_ax3 |- = y + y 0 | |
5:d6,3:ax-mp |- forall x = x + x 0 |
This file contains 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 cv2 | |
import numpy as np | |
from tqdm import tqdm | |
def test_frame_gen(limit=None): | |
fq = [] | |
cap = cv2.VideoCapture("data/test.mp4") | |
cnt = 0 | |
while 1: | |
ret, frame = cap.read() |
This file contains 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
%pylab inline | |
%load_ext autoreload | |
%autoreload 2 | |
from tools.lib.route import Route | |
from tools.lib.logreader import LogReader | |
r,num = Route("ce2fbd370f78ef21|2020-11-27--16-27-28"),10 | |
#r,num = Route("f66032c2b5aa18ac|2020-12-04--09-33-54"),30 | |
alr = [] | |
for n in range(num-1, num+5): |
OlderNewer