Skip to content

Instantly share code, notes, and snippets.

View gyglim's full-sized avatar

Michael Gygli gyglim

View GitHub Profile
gyglim / youtube_video_ids.txt
Last active July 29, 2020 15:55
Videos with few or no shot boundaries
"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{}},\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",
gyglim /
Last active December 7, 2018 13:31
Example for loading the splits used in "Exploring Compositional High Order Pattern Potentials for Structured Output Learning" from Li et al.
# TODO: Get weizmann_32_32_trainval.mat from
# TODO: Get horse.mat from
# TODO: Update the paths below
# Imports
import matplotlib.pyplot as plt
import numpy as np
gyglim / weizman_splits.json
Created December 7, 2018 12:55
Splits used Deep Value Networks Learn to Evaluate and Iteratively Refine Structured Outputs, which follows: Exploring Compositional High Order Pattern Potentials for Structured Output Learning
"test": [
gyglim /
Created March 17, 2017 09:16
Wrapper around subprocess to debug moviepy OSErrors
"""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')
from moviepy.editor import VideoFileClip
import cv2
size= (128, 128)
v1 = VideoFileClip(video_file, target_resolution=size, resize_algorithm='bilinear').subclip(0, 60)
def read_resized():
for f in v1.iter_frames():
gyglim /
Created March 8, 2017 14:36
Decorator to timeout function calls and correctly re-raise Exceptions
"""Function to build timeout dectorators for specific times.
Example usage:
def x(): time.sleep(2)
will raise a TimeoutException.
gyglim /
Last active September 21, 2017 15:23
Lasagne rank loss
def rank_loss(prediction, margin=1):
Implementation of a pairwise rank loss, based on
:param prediction:
:param target_var:
score_pos = prediction[0::2]
score_neg = prediction[1::2]
gyglim /
Last active August 23, 2023 21:29
Logging to tensorboard without tensorflow operations. Uses manually generated summaries instead of summary ops
"""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