Skip to content

Instantly share code, notes, and snippets.

View DrraBL's full-sized avatar

Dorra DrraBL

View GitHub Profile
@JDWarner
JDWarner / _dice.py
Last active January 25, 2023 22:28
Dice coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity measurement (though note it is not a true metric; it does not satisfy the triangle inequality). The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the mod…
"""
_dice.py : Dice coefficient for comparing set similarity.
"""
import numpy as np
def dice(im1, im2):
"""
@brunodoamaral
brunodoamaral / _dice.py
Last active March 16, 2024 18:00 — forked from JDWarner/_dice.py
Dice coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity measurement (though note it is not a true metric; it does not satisfy the triangle inequality). The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the mod…
def dice(im1, im2, empty_score=1.0):
"""
Computes the Dice coefficient, a measure of set similarity.
Parameters
----------
im1 : array-like, bool
Any array of arbitrary size. If not boolean, will be converted.
im2 : array-like, bool
Any other array of identical size. If not boolean, will be converted.
Returns
@brookisme
brookisme / unet-se.ipynb
Last active July 10, 2024 12:50
UNET with Squeeze and Excitation Blocks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mingrui
mingrui / dice.py
Last active October 25, 2022 13:46
calculate mri nifti segmentation dice score
import nibabel as nib
def test_nifti_all_labels_dice_score(seg_path, seg_file, truth_path, truth_file):
truth_uid = os.listdir(truth_path)
print(truth_uid)
dice_score = 0
for uid in truth_uid:
seg_file_path = os.path.join(seg_path, uid, seg_file)
truth_file_path = os.path.join(truth_path, uid, truth_file)
seg_nib = nib.load(seg_file_path)
@Shreeyak
Shreeyak / create_pointCloud.py
Created May 2, 2019 10:23
Script to create a point cloud and save to .ply file from an RGB and Depth Image
#!/usr/bin/env python3
import numpy as np
from PIL import Image
import imageio
import OpenEXR
import struct
import os
def get_pointcloud(color_image,depth_image,camera_intrinsics):
@Birch-san
Birch-san / CUDA-12-1-1-pytorch.md
Last active June 27, 2024 09:25
Installing CUDA 12.1.1 + PyTorch nightly + Python 3.10 on Ubuntu 22.10

Installing CUDA 12.1.1 + PyTorch nightly + Python 3.10 on Ubuntu 22.10

Should you keep your NVIDIA driver?

CUDA 12.1.1 toolkit is gonna offer to install Nvidia driver 530 for us. It's from New Feature branch. It's likely to be newer than the default Nvidia driver you would've installed via apt-get (apt would prefer to give you 525, i.e. Production Branch).

If you're confident that you already have a new enough Nvidia driver for CUDA 12.1.1, and you'd like to keep your driver: feel free to skip this "uninstall driver" step.

But if you're not sure, or you know your driver is too old: let's uninstall it. CUDA will install a new driver for us later.