Skip to content

Instantly share code, notes, and snippets.

@meetps
meetps / computeIoU.py
Created February 11, 2017 14:02
Intersection over Union for Python [ Keras ]
import numpy as np
def computeIoU(y_pred_batch, y_true_batch):
return np.mean(np.asarray([pixelAccuracy(y_pred_batch[i], y_true_batch[i]) for i in range(len(y_true_batch))]))
def pixelAccuracy(y_pred, y_true):
y_pred = np.argmax(np.reshape(y_pred,[N_CLASSES_PASCAL,img_rows,img_cols]),axis=0)
y_true = np.argmax(np.reshape(y_true,[N_CLASSES_PASCAL,img_rows,img_cols]),axis=0)
y_pred = y_pred * (y_true>0)
@vsubhashini
vsubhashini / readme.md
Last active January 24, 2023 21:43
Sequence to Sequence - Video to Text (S2VT)
@PhirePhly
PhirePhly / memdjpeg.c
Created July 10, 2012 02:33
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//