This file contains 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
"""Simple example on how to log scalars and images to tensorboard without tensor ops. | |
License: BSD License 2.0 | |
""" | |
__author__ = "Michael Gygli" | |
import tensorflow as tf | |
from StringIO import StringIO | |
import matplotlib.pyplot as plt | |
import numpy as np |
This file contains 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
def rank_loss(prediction, margin=1): | |
''' | |
Implementation of a pairwise rank loss, based on https://github.com/Lasagne/Lasagne/issues/168#issuecomment-81134242 | |
:param prediction: | |
:param target_var: | |
:return: | |
''' | |
score_pos = prediction[0::2] | |
score_neg = prediction[1::2] |
This file contains 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 to build timeout dectorators for specific times. | |
Example usage: | |
@timeout(1) | |
def x(): time.sleep(2) | |
x() | |
will raise a TimeoutException. |
This file contains 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 moviepy.editor import VideoFileClip | |
import cv2 | |
size= (128, 128) | |
video_file='/home/gyglim/scratch_gygli/gifscom/shot_detection/debug_videos/UEoUURJ1Dck.mp4' | |
v1 = VideoFileClip(video_file, target_resolution=size, resize_algorithm='bilinear').subclip(0, 60) | |
def read_resized(): | |
for f in v1.iter_frames(): | |
pass |
This file contains 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
"""Wrapper around subprocess that logs the calls to Popen and tracks how many pipes are open""" | |
import inspect | |
import os | |
import subprocess as sp | |
import logging | |
import sys | |
logger = logging.getLogger('subprocess') | |
logger.setLevel(logging.DEBUG) | |
This file contains 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
{ | |
"test": [ | |
"horse018.jpg", | |
"horse087.jpg", | |
"horse193.jpg", | |
"horse179.jpg", | |
"horse285.jpg", | |
"horse017.jpg", | |
"horse059.jpg", | |
"horse088.jpg", |
This file contains 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
# TODO: Get weizmann_32_32_trainval.mat from https://www.cs.toronto.edu/~yujiali/papers/chopps.zip | |
# TODO: Get horse.mat from https://www.cs.toronto.edu/~yujiali/papers/cvpr13_data.zip | |
# TODO: Update the paths below | |
split_path='YOUR_PATH_TO/weizmann_32_32_trainval.mat' | |
data_path='YOUR_PATH_TO/horse.mat' | |
# Imports | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.io |
This file contains 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
{ | |
"citation": "\n@inproceedings{coates2011stl10,\n title={{An Analysis of Single Layer Networks in Unsupervised Feature Learning}},\n author={Coates, Adam and Ng, Andrew and Lee, Honglak},\n booktitle={AISTATS},\n year={2011},\n note = {\\url{https://cs.stanford.edu/~acoates/papers/coatesleeng_aistats_2011.pdf}},\n}\n", | |
"description": "The STL-10 dataset is an image recognition dataset for developing unsupervised\nfeature learning, deep learning, self-taught learning algorithms. It is inspired\nby the CIFAR-10 dataset but with some modifications. In particular, each class\nhas fewer labeled training examples than in CIFAR-10, but a very large set of \nunlabeled examples is provided to learn image models prior to supervised\ntraining. The primary challenge is to make use of the unlabeled data (which\ncomes from a similar but different distribution from the labeled data) to build\na useful prior. All images were acquired from labeled examples on ImageNet.\n", | |
"downloadSize": "2640397119", | |
"location |
This file contains 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
LtPYB0gpVrM | |
7TLngTUG9BU | |
3YeFK_mBl48 | |
GReJlr_Fr8M | |
hQLqAou-_hU | |
zecY4uuXwSI | |
EaleKN9GQ54 | |
RK1pR1Edax0 | |
MVoLvrS_fFI | |
PxlEbfLy6GI |