Skip to content

Instantly share code, notes, and snippets.

@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active July 21, 2024 08:16
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@aaronpolhamus
aaronpolhamus / map_clsloc.txt
Created May 12, 2016 01:21
Image net classes + labels
n02119789 1 kit_fox
n02100735 2 English_setter
n02110185 3 Siberian_husky
n02096294 4 Australian_terrier
n02102040 5 English_springer
n02066245 6 grey_whale
n02509815 7 lesser_panda
n02124075 8 Egyptian_cat
n02417914 9 ibex
n02123394 10 Persian_cat
/**
* [TF2] Jungle Inferno Equipment
*/
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <clientprefs>
#include <sdkhooks>
@Kaixhin
Kaixhin / transformer.py
Created April 7, 2018 21:34
The Annotated Transformer
"""
The Annotated Transformer
http://nlp.seas.harvard.edu/2018/04/03/attention.html
Note: Only includes basic example, not real world example or multi-GPU training
"""
import numpy as np
import torch
import torch.nn as nn
@hlorand
hlorand / vidstab_ffmpeg.md
Last active June 22, 2024 19:07
Video stabilization using VidStab and FFMPEG

Video stabilization using VidStab and FFMPEG

** Step 1 **

Install ffmpeg with the vidstab plugin.

@jcreinhold
jcreinhold / rpca_gpu.py
Last active February 7, 2024 04:10
GPU RPCA and SVT
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
rpca_gpu
implementations of RPCA on the GPU (leveraging pytorch)
for low-rank and sparse matrix decomposition as well as
a nuclear-norm minimization routine via singular value
thresholding for matrix completion
@vadimkantorov
vadimkantorov / perlin.py
Last active February 15, 2024 10:36
Perlin noise in PyTorch
# ported from https://github.com/pvigier/perlin-numpy/blob/master/perlin2d.py
import torch
import math
def rand_perlin_2d(shape, res, fade = lambda t: 6*t**5 - 15*t**4 + 10*t**3):
delta = (res[0] / shape[0], res[1] / shape[1])
d = (shape[0] // res[0], shape[1] // res[1])
grid = torch.stack(torch.meshgrid(torch.arange(0, res[0], delta[0]), torch.arange(0, res[1], delta[1])), dim = -1) % 1
# git clone https://github.com/NVlabs/stylegan2
import os
import numpy as np
from scipy.interpolate import interp1d
from scipy.io import wavfile
import matplotlib.pyplot as plt
import PIL.Image
import moviepy.editor
import dnnlib
@Mr4k
Mr4k / differentialdithering.ipynb
Created September 9, 2020 02:32
DifferentialDithering.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aormorningstar
aormorningstar / rotation.py
Last active January 12, 2024 21:24
Find the rotation matrix that aligns one three-dimensional vector with another.
import numpy as np
def rotation(v1, v2):
"""
Compute a matrix R that rotates v1 to align with v2.
v1 and v2 must be length-3 1d numpy arrays.
"""
# unit vectors
u = v1 / np.linalg.norm(v1)
Ru = v2 / np.linalg.norm(v2)