Skip to content

Instantly share code, notes, and snippets.

@sherwoac
sherwoac / exvironment.yml
Created July 27, 2022 23:20
HSBC pdf statements to csv
name: pdf_extractor_env
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- blas=1.0=openblas
- bottleneck=1.3.5=py39h7deecbd_0
- brotli=1.0.9=he6710b0_2
@sherwoac
sherwoac / instant_ngp_env.yml
Created March 28, 2022 19:47
conda env for nvidia instant ngp
name: instant_ngp_env
channels:
- nvidia
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=4.5=1_gnu
- alsa-lib=1.2.3=h516909a_0
- blas=1.0=mkl
@sherwoac
sherwoac / sherwoac.gif
Last active February 22, 2022 22:01
NVidia Instant NGP NERF logo
sherwoac.gif
@sherwoac
sherwoac / gist:ddfd4f9e4a5e60e883c348ad81607b6e
Last active January 19, 2022 10:42
_get_unit_square_intercepts
def _get_unit_square_intercepts(self, slopes, intercept):
"""
returns unit square intercepts for given slope (a) and intercepts (b)
y = ax + b
solves:
right: y = a + b
x = 1
y = slopes + intercept
left: y = b
x = 0
@sherwoac
sherwoac / learnable_rotation_matrix
Last active January 19, 2021 14:25
learnable_rotation_matrix in tensorflow
# cf from https://arxiv.org/abs/1812.07035
import tensorflow as tf
def rotation_matrix_to_label_6d_flat(rotation_matrices):
"""
takes batch x 3x3 rotation matrix, returns a flat batch x 6 floats for loss
:param rotation_matrices: batch x (3x3) rotation matrix
:return: flat batch x 6 floats for loss
"""
return tf.concat([rotation_matrices[:, :, 0], rotation_matrices[:, :, 1]], axis=1)
@sherwoac
sherwoac / keras_example.py
Created September 9, 2020 16:24
Embedding clustering vs embedding size - KERAS, TSNE
import numpy as np
import tensorflow as tf
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from matplotlib import cm
def explore_embedding_size(number_of_categories, embedding_sizes):
fig = plt.figure(figsize=(15, 9))
figure_title = f"Embedding size TSNEs for {number_of_categories} categories"