Skip to content

Instantly share code, notes, and snippets.

View Osrip's full-sized avatar

Jan Osrip

  • Tübingen
View GitHub Profile
@hatzel
hatzel / scheduler_visualize.py
Created October 25, 2019 09:56
Quickly Visualize PyTorch Learning Schedulers
import torch
from torch.optim.lr_scheduler import CosineAnnealingLR
from torch.optim import SGD
import matplotlib.pyplot as plt
STEPS = 100
optimizer = SGD([torch.tensor(1)], lr=1)
# Use a scheduler of your choice below.
# Great for debugging your own schedulers!
@kmuehlbauer
kmuehlbauer / xarray_pysteps.ipynb
Last active January 13, 2024 14:18
xarray and pysteps, just good friends
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wheatdog
wheatdog / install.sh
Created June 17, 2019 08:00
Install rclone without root
#!/usr/bin/env bash
trap_exit() {
if [[ ! -o xtrace ]]; then
rm -rf "$tmp"
fi
}
tmp=$(mktemp -dt)
@brienna
brienna / emojis_plotted.py
Last active April 12, 2024 11:20
Plotting emojis with Matplotlib
import matplotlib.pyplot as plt, numpy as np
from matplotlib.font_manager import FontProperties
# Load Apple Color Emoji font
prop = FontProperties(fname='/System/Library/Fonts/Apple Color Emoji.ttc')
# Set up plot
freqs = [301, 96, 53, 81, 42]
labels = ['😊', '😱', '😂', '😄', '😛']
plt.figure(figsize=(12,8))
@christian-rauch
christian-rauch / class_weights.py
Last active July 5, 2023 14:06
class weights by median frequency balancing
#!/usr/bin/env python
import sys, os
import glob
import numpy as np
import skimage.io as io
np.set_printoptions(precision=15)
files = glob.glob(os.path.join(sys.argv[1], "*.png"))