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
""" | |
Plots the decision boundary and the loss as a function of training time/epochs | |
for perceptron (no hidden layer) or single hidden layer MLP for difefrent datasets ('moons', 'blobs', 'xor') | |
requires: | |
pip install torch torchvision torchaudio matplotlib tqdm seaborn moviepy scipy scikit-learn |
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
""" | |
Flip a fair coin 100 times—it gives a sequence of heads (H) and tails (T). | |
For each HH in the sequence of flips, Alice gets a point; for each HT, Bob does, | |
so e.g. for the sequence THHHT Alice gets 2 points and Bob gets 1 point. | |
Who is most likely to win? | |
https://x.com/littmath/status/1769044719034647001?s=20 | |
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
# Makefile to create arxiv submission conforming single latex files. Created originaly by Uwe Schmidt | |
all: pdf | |
pdf: main.tex | |
pdflatex main.tex | |
# http://stackoverflow.com/a/21935690 | |
-biber main | |
pdflatex main.tex |
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
name: dl-image-mw | |
channels: | |
- defaults | |
- nvidia | |
dependencies: | |
- python=3.9 | |
- cudatoolkit=11.0.* | |
- cudnn=8.0.* | |
- jupyter | |
- numpy |
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
""" | |
The default momentum of MobileNet (for running average calculation) in tf seems to be very high (0.99?), resulting in huge (and suprising) differences in train vs evaluate loss | |
https://github.com/keras-team/keras/issues/6977 | |
Setting it to something sensible (e.g. 0.9) fixes this | |
https://stackoverflow.com/questions/65415799/fit-works-as-expected-but-then-during-evaluate-model-performs-at-chance/66692755#66692755 | |
""" |
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
# Average-Downsampling example in OpenCL (via gputools) | |
# please install it first via | |
# pip install gputools | |
import numpy as np | |
from gputools import OCLProgram, OCLArray, get_device | |
from timeit import default_timer | |
from skimage.transform import downscale_local_mean | |
# opencl kernel |
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 tensorflow as tf | |
import numpy as np | |
import psutil | |
import os | |
from stardist.models import Config3D, StarDist3D | |
os.environ['CUDA_VISIBLE_DEVICES']= "0"# '1,0' | |
from tensorflow.keras.utils import Sequence | |
import stardist |
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
/* QuPath-Script to export annotations to label tif images (e.g. to be used for stardist) | |
Use "Run for project" to export annotations for all images within a QuPath project | |
Afterwards both images and mask tiffs will be stored in the project subfolder | |
ground_truth | |
├── images | |
└── masks | |
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 | |
import matplotlib.pyplot as plt | |
from scipy.ndimage import label, zoom | |
from stardist.matching import matching | |
from stardist.plot import render_label, render_label_pred | |
np.random.seed(42) | |
def create_example(): | |
rand_gt = np.random.uniform(0,1,(8,8)) |
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
#@ ImagePlus imp | |
#@ OUTPUT ImagePlus result | |
from ij import IJ | |
from ij.plugin.frame import RoiManager | |
result = IJ.createImage("Labeling", "16-bit black", imp.getWidth(), imp.getHeight(), 1) | |
ip = result.getProcessor() | |
rm = RoiManager.getInstance() |
NewerOlder