This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A minimal profiler to compare speed differences between reading a video with opencv | |
and DALI. | |
For both dataloaders, the goal is to read an mp4 video and then load batches of frames | |
onto the GPU. | |
""" | |
import os | |
import logging | |
import time | |
import subprocess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A small wrapper around hickle to allow the usage of python dictionaries with | |
slashes in key names. | |
Feature proposal: https://github.com/telegraphic/hickle/issues/124 | |
Hickle license: https://github.com/telegraphic/hickle/blob/master/LICENSE | |
Author: Samuel Albanie | |
""" | |
# --------------------------------------------- | |
# Monkey patch | |
# --------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dag = toDagNN(net, customObj) | |
%TODAGNN Converts a compiled AutoNN network to a DagNN object | |
% DAG = toDagNN(NETOUTPUTS) converts a set of Autonn outputs | |
% (i.e. a set of recursively nested layer objects), into a dagnn object, | |
% DAG. | |
% TODO(samuel): clean up | |
if nargin < 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import matplotlib | |
matplotlib.use('Agg') | |
import colorsys | |
import caffe | |
import json | |
import pdb | |
import time | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import matplotlib | |
matplotlib.use('Agg') | |
import colorsys | |
import caffe | |
import json | |
import pdb | |
import time | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function issue_814 | |
% demo for @segman | |
% fix random seed to get repeatable result | |
rng(1) ; | |
sample = rand(21, 21, 3, 'single') ; | |
label = [ 1 1 1 1 1 ; | |
1 1 1 1 1 ; | |
1 2 2 2 1 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import caffe | |
import pdb | |
import numpy as np | |
class PyBlankDataLayer(caffe.Layer): | |
""" | |
A blank python data layer that initialises once with zeros | |
according during construction and does no further operations | |
(useful for layer testing). | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np, math | |
"""Define the periodic function""" | |
def f(t): | |
return math.cos(2 * math.pi * t) + 0.5 * math.cos( 4 * math.pi * t) | |
"""Define inputs, find outputs and plot graph""" | |
inputs = np.linspace(-2, 2, 100) |