Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

etienne87

🏠
Working from home
View GitHub Profile
@etienne87
etienne87 / siren.py
Last active Jun 24, 2020
very scruffy script to show case siren networks
View siren.py
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
@etienne87
etienne87 / full_plastic_batched.py
Created Nov 24, 2019
differentiable_plasticity_uber
View full_plastic_batched.py
# 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
#
@etienne87
etienne87 / world_to_camera_and_back.py
Last active Aug 1, 2019
world_to_camera_and_back
View world_to_camera_and_back.py
#!/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 *
View viz_ts.py
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
@etienne87
etienne87 / draw_mickey.py
Created Jun 29, 2019
trying to draw mickey using binary cross entropy
View draw_mickey.py
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):
@etienne87
etienne87 / image_stitching.py
Last active Jun 23, 2019
image stitching experiment
View image_stitching.py
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 Jun 14, 2019
conv_rnn_modules.py
View 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 Jun 14, 2019
conv_rnn_test.py
View 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 Sep 22, 2020
Histogram-of-Oriented Gradient in Pytorch in 10 minutes
View HogLayer.py
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()
View 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
You can’t perform that action at this time.