View wget_drive.py
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
import requests | |
def download_file_from_google_drive(id, destination): | |
def get_confirm_token(response): | |
for key, value in response.cookies.items(): | |
if key.startswith('download_warning'): | |
return value | |
return None |
View sample_entropy.py
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
import torch | |
import torch.nn | |
from torch.autograd import Variable | |
def pairwise_euclidean(samples): | |
B = samples.size(0) | |
samples_norm = samples.mul(samples).sum(1) | |
samples_norm = samples_norm.expand(B, B) |
View Springleaf.html
This file has been truncated, but you can view the full file.
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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /> | |
<title>Feats_work-clean</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/*! | |
* |
View html_server.py
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 flask import Flask, request, render_template | |
app = Flask(__name__, static_url_path='', static_folder='') | |
@app.route('/') | |
def root(): | |
return app.send_static_file('sr_set5.html') | |
@app.route('/readme') |
View imscatter.py
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 imscatter(images, positions): | |
positions = np.array(positions) | |
bottoms = positions[:,1] - np.array([im.shape[1]/2.0 for im in images]) | |
tops = bottoms + np.array([im.shape[1] for im in images]) | |
lefts = positions[:,0] - np.array([im.shape[0]/2.0 for im in images]) | |
rigths = lefts + np.array([im.shape[0] for im in images]) | |
View trilinear_interpolation.py
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
import numba | |
def FindLowAndHighIndices(x, m): | |
xf = np.floor(x) | |
l = np.clip(xf, 0, m-1).astype(int) | |
h = np.clip(xf + 1, 0, m-1).astype(int) | |
return l, h |
View get_sample_grid.py
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
import random | |
from PIL import Image | |
import glob | |
import numpy as np | |
def get_sample_grid_(paths, grid_w=4, grid_h=4, imsize_w=256, imsize_h=256): | |
imgs = [] | |
for p in paths: | |
imgs.append(np.array(Image.open(p).convert('RGB').resize([imsize_w,imsize_h]))) |
View run_batch.py
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 joblib import Parallel, delayed | |
import Queue | |
import os | |
# Define number of GPUs available | |
N_GPU = 4 | |
# Put indices in queue | |
q = Queue.Queue(maxsize=N_GPU) | |
for i in range(N_GPU): |
View run_batch2.py
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 __future__ import print_function | |
import threading | |
from joblib import Parallel, delayed | |
import Queue | |
import os | |
# Fix print | |
_print = print | |
_rlock = threading.RLock() | |
def print(*args, **kwargs): |
View test_backend.py
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 __future__ import print_function | |
import threading | |
from joblib import Parallel, delayed | |
import Queue | |
# Fix print | |
_print = print | |
_rlock = threading.RLock() | |
def print(*args, **kwargs): | |
with _rlock: |
NewerOlder