Skip to content

Instantly share code, notes, and snippets.

View tdeboissiere's full-sized avatar

Thibault Main de Boissiere tdeboissiere

View GitHub Profile
============================= test session starts ==============================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/tmain/dvc, inifile:
plugins: sugar-0.9.1, remotedata-0.2.0, openfiles-0.2.0, doctestplus-0.1.2, arraydiff-0.2
collected 1 item
tests/test_install.py F [100%]
=================================== FAILURES ===================================
_______________________________ TestInstall.test _______________________________
============================= test session starts ==============================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/tmain/Lyrebird/dvc, inifile:
plugins: sugar-0.9.1, remotedata-0.2.0, openfiles-0.2.0, doctestplus-0.1.2, arraydiff-0.2
collected 1 item
tests/test_install.py F [100%]
=================================== FAILURES ===================================
_______________________________ TestInstall.test _______________________________
####################################
# Apt libraries
####################################
sudo apt-get update && sudo apt-get install -y --no-install-recommends\
build-essential \
vim \
numactl \
git \
curl \
git \
@tdeboissiere
tdeboissiere / kl.py
Last active December 29, 2017 00:16
KL for scalar gaussian mixture
import math
import numpy as np
import tensorflow as tf
log_sigma1 = 0.
log_sigma2 = -0.5
prior_pi = 0.25
sigma1 = math.exp(log_sigma1)
sigma2 = math.exp(log_sigma2)
def extract_patches(imgs, landmarks, patch_shape):
""" Extracts patches from an image.
Args:
imgs: a numpy array of dimensions [batch_size, width, height, channels]
landmarks: a numpy array of dimensions [num_patches, 2]
patch_shape: (width, height)
Returns:
a numpy array [num_patches, width, height, channels]
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
from yellowfin_tuner import YFOptimizer
from tqdm import tqdm
import torch
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import torch.optim as optim
import torch.nn.functional as F
import time
from torchvision.models import vgg
# Initialize network
import pandas as pd
import numpy as np
from tsfresh.feature_extraction import feature_calculators as fc
from time import time
def count_above_mean(x):
x = np.asarray(x)
m = np.mean(x)
@tdeboissiere
tdeboissiere / test_fit_generator.py
Created May 16, 2016 06:29
Keras fit_generator speed test
from __future__ import print_function
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras.utils import generic_utils
import multiprocessing
import os
import time