Skip to content

Instantly share code, notes, and snippets.

Thouis (Ray) Jones thouis

Block or report user

Report or block thouis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View delete_old_tweets.py
import sys
import twitter
import time
# see https://python-twitter.readthedocs.io/en/latest/getting_started.html
api = twitter.Api(consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token_key=ACCESS_TOKEN,
access_token_secret=ACCESS_SECRET)
View Sphere sampling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View keybase.md

Keybase proof

I hereby claim:

  • I am thouis on github.
  • I am thouis (https://keybase.io/thouis) on keybase.
  • I have a public key whose fingerprint is A4F6 3AF2 C0E4 8CAE 7501 2BDE 2904 0D09 3557 95A4

To claim this, I am signing this object:

View depth_to_space.py
def depth_to_space(x, blocksize=2):
b, k, d, r, c = x.shape
r1 = x.reshape((b, k // (blocksize ** 2), blocksize, blocksize, d, r, c))
r2 = r1.transpose(0, 1, 4, 5, 2, 6, 3)
return r2.reshape((b, k // (blocksize ** 2), d, r * blocksize, c * blocksize))
@thouis
thouis / rand.py
Last active Aug 11, 2019
more straightforward adjusted rand error
View rand.py
# coding=utf-8
import numpy as np
import scipy.sparse as sparse
# Evaluation code courtesy of Juan Nunez-Iglesias, taken from
# https://github.com/janelia-flyem/gala/blob/master/gala/evaluate.py
def adapted_rand(seg, gt, all_stats=False):
"""Compute Adapted Rand error as defined by the SNEMI3D contest [1]
View batchnorm.py
import tensorflow as tf
from tensorflow.python import control_flow_ops
# from http://stackoverflow.com/a/34634291
def batch_norm(x, n_out, phase_train, scope='bn', affine=True):
"""
Batch normalization on convolutional maps.
Args:
x: Tensor, 4D BHWD input maps
n_out: integer, depth of input maps
@thouis
thouis / 0_reuse_code.js
Created May 12, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View compare.py
import sys
import h5py
import numpy as np
def pygame(h5, name, board, moves):
for idx in range(board.shape[0]):
for plane in range(board.shape[1]):
if plane < 44:
# different board orderings
f = board[idx, plane, ...].T[:, ::-1]
View OGS Rank Survey.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View test_unpooling.lua
local grad = require 'autograd'
local nn = require 'nn'
local W1 = torch.FloatTensor(1, 1, 10, 10):normal()
local pooler = nn.SpatialMaxPooling(2, 2, 2, 2)
local unpooler = nn.SpatialMaxUnpooling(pooler)
-- not sure why these lines are necessary.
pooler.indices = torch.FloatTensor()
pooler.output = torch.FloatTensor()
You can’t perform that action at this time.