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 hashlib | |
with open('names.txt', 'r') as f: | |
names = f.read().splitlines() | |
def uid2name(string, num): | |
hashobj = hashlib.sha256(string.encode('utf-8')) | |
val_hex = int(hashobj.hexdigest(), 16)%(2**32-1) |
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
@torch.jit.script | |
def drloop(V: torch.Tensor,T: torch.Tensor) -> torch.Tensor: | |
n = len(V) | |
Ri = torch.zeros((3,), dtype=torch.float32, device=V.device) | |
Ri[0] = -T[0][1] | |
Ri[1] = T[0][0] | |
Ri[2] = 0 | |
Ris = [Ri[None]] | |
for i in range(n - 1): |
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 matplotlib.pyplot as plt | |
plt.switch_backend('tkagg') | |
import torch as th | |
import torch.nn.functional as F | |
import numpy as np | |
import cv2 | |
from scipy.spatial.transform import Rotation |
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
""" | |
binary dilation in numba cuda | |
>> python cuda_binary_dilate_3d.py 512 512 512 1 | |
>>> runtime: 0.001s on a Nvidia TitanXP. | |
""" | |
import numba | |
import numpy as np | |
import time | |
from numba import cuda |
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
""" | |
Local Convolutions in pytorch | |
""" | |
import torch | |
import torch.nn.functional as F | |
b,c,h,w = 2,3,32,32 | |
d = 3 | |
n = h*w |
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 | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
from ranger import Ranger | |
import numpy as np | |
import random | |
import cv2 |
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
# Differentiable plasticity: binary pattern memorization and reconstruction | |
# | |
# Copyright (c) 2018 Uber Technologies, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
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
#!/usr/bin/python | |
from __future__ import print_function | |
""" | |
* World To Camera & Back (projective equations of pinhole cameras) * | |
* -------------------- * | |
* The OpenCV reference frame: * | |
* (or sometimes called "Camera Reference Frame"): * | |
* Z points towards the direction of forward motion of the camera * | |
* X points right wrt Y * |
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
from __future__ import print_function | |
import time | |
import numpy as np | |
import cv2 | |
from prophesee_utils.td_video import ChronoVideo | |
if __name__ == '__main__': | |
delay = 1 | |
base_delay = 1 | |
stop = False |
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 | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import random | |
def bce_loss_with_logits(x, y): |
NewerOlder