def produce_segmentation(data, model): f = theano.function( inputs=[model.input], outputs=model.blocks[3].output ) m = data.shape[0] output = [0] * m for i in xrange(m): S = f(data[i:i + 1]).reshape([37, 17]) output[i] = imgproc.resize(S, [160, 80]) return np.asarray(output)
def imgprep(img): img = imgproc.resize(img, [160, 80], keep_ratio='height') img = imgproc.subtract_luminance(img) img = np.rollaxis(img, 2) return (img / 100.0).astype(np.float32)
def choose_seg(seg, title): from dlearn.utils import imgproc val = conf.seg_pix[title] img = (seg == val).astype(np.float32) img = imgproc.resize(img, [37, 17]) return img.astype(np.float32)
def choose_seg(seg, title): val = conf.seg_pix[title] img = (seg == val).astype(np.float32) img = imgproc.resize(img, [37, 17]) return img.astype(np.float32)
def imgresize(img): img = imgproc.resize(img, [160, 80], keep_ratio='height') return img