Skip to content

Instantly share code, notes, and snippets.

View andreped's full-sized avatar
🐛
busy making bugs to stay employed

André Pedersen andreped

🐛
busy making bugs to stay employed
View GitHub Profile
@AlexandreAbraham
AlexandreAbraham / unsupervised_alt.py
Last active July 31, 2024 03:42
These are two implementations of the silhouette score. They are compatible with the scikit learn implementation but offers different drawbacks in term of complexity and memory usage. The slow version needs no memory but is painfully slow and should, I think, not be used. The second one is based on a block strategy: distance between samples and c…
""" Unsupervised evaluation metrics. """
# License: BSD Style.
from itertools import combinations
import numpy as np
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import distance_metrics
from sklearn.metrics.pairwise import pairwise_distances
@ctrueden
ctrueden / bio-formats.py
Last active January 1, 2023 08:26
Jython example script for working with the Bio-Formats API in Fiji.
# read in and display ImagePlus object(s)
from loci.plugins import BF
file = "/Users/curtis/data/tubhiswt4D.ome.tif"
imps = BF.openImagePlus(file)
for imp in imps:
imp.show()
# read in and display ImagePlus(es) with arguments
from loci.common import Region
from loci.plugins.in import ImporterOptions
@rxaviers
rxaviers / gist:7360908
Last active November 18, 2024 10:08
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@thirdwing
thirdwing / memory_check.cpp
Created August 16, 2014 19:57
C++ code to print out runtime memory usage
#include <iostream>
#include <fstream>
#include <unistd.h>
void process_mem_usage(double& vm_usage, double& resident_set)
{
vm_usage = 0.0;
resident_set = 0.0;
// the two fields we want
@kevin-keraudren
kevin-keraudren / volume_rendering.py
Last active December 8, 2023 17:10
Volume rendering in Python using VTK-SimpleITK
#!/usr/bin/python
import SimpleITK as sitk
import vtk
import numpy as np
import sys
from vtk.util.vtkConstants import *
filename = sys.argv[1]
@somada141
somada141 / volume_rendering_vtk.py
Last active May 1, 2021 05:24
Volume rendering in Python using VTK-SimpleITK #python #visualization #vtk #simpleitk #itk
#!/usr/bin/python
import SimpleITK as sitk
import vtk
import numpy as np
from vtk.util.vtkConstants import *
def numpy2VTK(img,spacing=[1.0,1.0,1.0]):
# evolved from code from Stou S.,
@lukas-h
lukas-h / license-badges.md
Last active November 11, 2024 03:22
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@auxiliary
auxiliary / volume_rendering.py
Created October 9, 2016 03:57 — forked from kevin-keraudren/volume_rendering.py
Volume rendering in Python using VTK-SimpleITK
#!/usr/bin/python
import SimpleITK as sitk
import vtk
import numpy as np
import sys
from vtk.util.vtkConstants import *
filename = sys.argv[1]
@dusenberrymw
dusenberrymw / keras_tips_and_tricks.md
Last active July 28, 2020 11:59
Keras Tips & Tricks

Keras Tips & Tricks

fit_generator

  • Can using either threading or multiprocessing for concurrent and parallel processing, respectively, of the data generator.
  • In the threading approach (model.fit_generator(..., pickle_safe=False)), the generator can be run concurrently (but not parallel) in multiple threads, with each thread pulling the next available batch based on the shared state of the generator and placing it in a shared queue. However, the generator must be threadsafe (i.e. use locks at synchronization points).
  • Due to the Python global interpreter lock (GIL), the threading option generally does not benefit from >1 worker (i.e. model.fit_generator(..., nb_worker=1) is best). One possible use case in which >1 threads could be beneficial is the presence of exceptionally long IO times, during which the GIL will be released to enable concurrency. Note also that TensorFlow's `session.run(