Skip to content

Instantly share code, notes, and snippets.

View etienne87's full-sized avatar
🐶
Working from home

etienne87

🐶
Working from home
View GitHub Profile
@etienne87
etienne87 / image_stitching.py
Last active June 23, 2019 10:17
image stitching experiment
from __future__ import print_function
import numpy as np
import imutils
import cv2
"""
Homecooked RANSAC, we will see if we manage to replace cv2.findHomography(..., cv2.RANSAC)
"""
def ransac(data, model, n, k, t, d):
bestfit = None
@etienne87
etienne87 / conv_rnn_modules.py
Last active June 14, 2019 15:29
conv_rnn_modules.py
# pylint: disable-all
import torch.nn as nn
from torch.nn import functional as F
import torch
def time_to_batch(x):
t, n = x.size()[:2]
x = x.view(n * t, *x.size()[2:])
return x, n
@etienne87
etienne87 / conv_rnn_test.py
Last active June 14, 2019 13:30
conv_rnn_test.py
# pylint: disable-all
import torch.nn as nn
from torch.nn import functional as F
import torch
def time_to_batch(x):
t, n = x.size()[:2]
x = x.view(n * t, *x.size()[2:])
return x, n
@etienne87
etienne87 / HogLayer.py
Last active March 23, 2024 16:36
Histogram-of-Oriented Gradient in Pytorch in 10 minutes
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import time
def timeit(x, func, iter=10):
torch.cuda.synchronize()
start = time.time()
@etienne87
etienne87 / timing_utils.py
Created May 14, 2019 10:26
timing_utils.py
from __future__ import division
import time
import numpy as np
class Timing:
def __init__(self):
self.total = 0
self.ncalls = 0
self.nevents = 0
self.last_num = -1
#!/usr/bin/python
# This script runs a random 3d animation & can retrieve:
# - detection
# - flow
# - zbuffer
#
# Copyright: (c) 2017-2018 Chronocam
import numpy as np
import cv2
@etienne87
etienne87 / data_augment_pytorch.py
Last active November 1, 2022 04:15
data augmentation in pytorch
# pylint: disable-all
from __future__ import print_function
import torch
import random
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from box import box_iou, box_clamp
import numpy as np
@etienne87
etienne87 / test_multithread_streaming.py
Created March 1, 2019 12:58
test of multiprocessing with python to stream temporally coherent batches
from __future__ import print_function
import glob
import sys
import time
import multiprocessing as mp, numpy as np, random
from prophesee_utils.td_video import ChronoVideo
import prophesee_utils.td_processing as tdp
import prophesee_utils.vis_utils as vis
import cv2
from numba import njit as jit
@etienne87
etienne87 / tf_bilateral_rgb.py
Created March 23, 2018 17:03
tf_bilateral_rgb.py
#!/usr/bin/python
# torch_bilateral: bi/trilateral filtering in tf
# Copyright: (c) 2017-2018 Prophesee
from __future__ import print_function
import tensorflow as tf
import numpy as np
import pdb
import time
@etienne87
etienne87 / torch_bilateral_rgb.py
Last active March 25, 2018 21:11
torch bilateral rgb
#!/usr/bin/python
# torch_bilateral: bi/trilateral filtering in torch
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.nn import Parameter
import numpy as np
import pdb
import time