Skip to content

Instantly share code, notes, and snippets.

View Freed-Wu's full-sized avatar
🤕
hurt

wzy Freed-Wu

🤕
hurt
View GitHub Profile
@jeremyjordan
jeremyjordan / soft_dice_loss.py
Last active September 20, 2023 12:50
Generic calculation of the soft Dice loss used as the objective function in image segmentation tasks.
def soft_dice_loss(y_true, y_pred, epsilon=1e-6):
'''
Soft dice loss calculation for arbitrary batch size, number of classes, and number of spatial dimensions.
Assumes the `channels_last` format.
# Arguments
y_true: b x X x Y( x Z...) x c One hot encoding of ground truth
y_pred: b x X x Y( x Z...) x c Network output, must sum to 1 over c channel (such as after softmax)
epsilon: Used for numerical stability to avoid divide by zero errors
@Konfekt
Konfekt / mailcap
Last active December 8, 2023 11:27
mutt mailcap file to display attachments in mutt mail client
# From http://wiki.free-unices.org/doku.php/config/mutt/new_mailcap
application/vnd.oasis.opendocument.text; mutt_bgrun okular %s; test=test -n "$DISPLAY"
application/vnd.oasis.opendocument.text; odt2txt %s | cat --squeeze-blank; copiousoutput
# application/vnd.oasis.opendocument.text; pandoc --from=odt --to=plain %s | cat --squeeze-blank ; copiousoutput
# application/vnd.oasis.opendocument.text; libreoffice --cat %s | cat --squeeze-blank ; copiousoutput
application/vnd.oasis.opendocument.spreadsheet; mutt_bgrun libreoffice --nologo %s; test=test -n "$DISPLAY"
application/vnd.oasis.opendocument.spreadsheet; odt2txt %s | cat --squeeze-blank; copiousoutput
# application/vnd.oasis.opendocument.spreadsheet; libreoffice --cat %s | cat --squeeze-blank ; copiousoutput