This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on implementations | |
# - vae core https://github.com/pytorch/examples/blob/master/vae/main.py | |
# - miwae https://github.com/yoonholee/pytorch-vae | |
# - notes on VAE from the article at https://iopscience.iop.org/article/10.3847/PSJ/ab9a52 (but can be taken from elsewhere too) | |
from __future__ import print_function | |
import argparse | |
import torch | |
import torch.utils.data | |
from torch import nn, optim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_trackbar/py_trackbar.html#trackbar | |
import cv2 | |
import numpy as np | |
class GUIHandler(object): | |
def onChangeSend(self,x): | |
self.A = cv2.getTrackbarPos('A', self.window_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# v1 | |
import mock | |
settings = mock.Mock() | |
settings.foo = 42 | |
# v2 | |
# works even when checking for non-existing entries... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Safe combination for Windows 10 (crazy, eh?) | |
GPU: GeForce 1050 Ti | |
Working: | |
Cuda 10 -> cuda_10.0.130_411.31_win10 | |
Cudnn for it -> cudnn-10.0-windows10-x64-v7.6.5.32(for CUDA 10.0).zip | |
Python 3.7.7 | |
Tensorflow-gpu 1.14.0 -> pip3 install --upgrade tensorflow-gpu==1.14.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
good_colors = [ #qualitative - http://colorbrewer2.org/#type=qualitative&scheme=Set1&n=6 | |
(228, 26, 28), #red | |
(55, 126, 184), #blue | |
(77, 175, 74), #lightgreen | |
(152, 78, 163), #violet | |
(255, 127, 0), #orange | |
(255, 255, 51), #yellow | |
(166, 86, 40), #brown orange | |
(247, 129, 191) #pink |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find SOURCEDIR/ -type f | shuf -n $(shuf -i30000-30000 -n1) | tr '\n' '\0' | xargs -0 -n1 cp -t TARGETDIR/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add padding to the image to be at 360x360 px | |
ffmpeg -i image.jpg -qscale 0 -vf "pad=360:360:360:360:color=black" imagePad.jpg | |
# auto overwrite | |
ffmpeg -y -i image.jpg -qscale 0 -vf "pad=360:360:360:360:color=black" image.jpg | |
# for all files in a folder | |
for file in *.jpg; do ffmpeg -y -i $file -qscale 0 -vf "pad=360:360:360:360:color=black" $file; done | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import librosa | |
import numpy as np | |
# Variables setup: | |
fft_size=2048 | |
window_size=2048 # window size | |
hop_size=512 # window shift size | |
sample_rate=44100 | |
lws_L = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# New remote | |
git remote add newremote https://github.com/user/repo.git | |
git push newremote master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib, os | |
if not('DISPLAY' in os.environ): | |
matplotlib.use("Agg") | |
import DataLoader, DataPreprocesser, Dataset, Debugger, Settings, ModelHandler, Evaluator | |
from timeit import default_timer as timer | |
from datetime import * | |
months = ["unk","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"] | |
month = (months[datetime.now().month]) |