Skip to content

Instantly share code, notes, and snippets.

View andiac's full-sized avatar
🦄
Yooooooooo

Andi Zhang andiac

🦄
Yooooooooo
View GitHub Profile
@andiac
andiac / restrict_imagenet128.py
Created November 14, 2023 02:11
Restrict Imagenet 128
import csv
import os
from PIL import Image
names = []
# https://www.kaggle.com/competitions/imagenet-object-localization-challenge/overview
file_path = './LOC_synset_mapping.txt'
# path to the imagenet folder
imagenet_path = './imagenet'
out_path = './imagenet128'
os.makedirs(out_path, exist_ok=True)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andiac
andiac / label_ood_proxy.ipynb
Created November 2, 2022 14:25
Plot the label-based OOD proxy introduced in https://arxiv.org/abs/2210.12767
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andiac
andiac / mis.ipynb
Last active July 31, 2022 17:59
Multiple Importance Sampling
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andiac
andiac / mitsuba_3_direct_integrator.ipynb
Last active July 21, 2022 21:02
This is a direct integrator for Mitsuba 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andiac
andiac / svg_to_tikz.py
Last active May 6, 2022 00:50
svg path to tikz code
import svgpathtools
from svgpathtools import svg2paths2
paths, attributes, svg_attributes = svg2paths2('doubleset.svg')
SCALE = 10
print("\\begin{tikzpicture}")
for path in paths:
print("\\begin{scope}")
for b in path:
@andiac
andiac / heteroskedastic_lr.ipynb
Last active March 15, 2022 18:40
Heteroskedastic linear regression...
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andiac
andiac / brownian_bridge.py
Created February 17, 2022 20:50
Generate brownian bridge
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
N = 10
T = 300
random_seed = 0
np.random.seed(random_seed)
@andiac
andiac / anim.py
Created February 10, 2022 22:51
Matplotlib patch animation
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import animation
from matplotlib.collections import PatchCollection
fig = plt.figure()
ax = plt.axes(xlim=(-1.5, 1.5), ylim=(-1.5, 1.5), aspect='equal')
# not visible