Skip to content

Instantly share code, notes, and snippets.

View cancan101's full-sized avatar

Alex Rothberg cancan101

View GitHub Profile
@cancan101
cancan101 / perspective-quadrilateral.ipynb
Created May 1, 2014 23:48
Automatic perspective correction for quadrilateral objects
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <Accelerate/Accelerate.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char * argv[])
{
// Description of the input image stack
sess, meta_graph_def = session_bundle.load_session_bundle_from_path(input)
signatures_any = sess.graph.get_collection(constants.SIGNATURES_KEY)
signatures = manifest_pb2.Signatures()
signatures_any[0].Unpack(signatures)
inputs = signatures.named_signatures['inputs'].generic_signature
input_name = inputs.map['images'].tensor_name
/*! dicom-parser - v1.5.0 - 2016-05-08 | (c) 2014 Chris Hafey | https://github.com/chafey/dicomParser */
(function (root, factory) {
// node.js
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();
}
else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.optimizers import Adamax
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
def main():
@cancan101
cancan101 / install-tensorflow.sh
Created February 3, 2016 20:05 — forked from erikbern/install-tensorflow.sh
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
#!/bin/sh
"exec" "python" "-u" "--" "$0" "$@"
import os
import sys
import time
class ForceIOStream:
{
"swaggerVersion": "1.2",
"apis": [
{
"operations": [
{
"parameters": [
{
@cancan101
cancan101 / $ref-issue.json
Created May 11, 2015 04:16
Issue with $ref in Swagger 1.2
{
"swaggerVersion": "1.2",
"apis": [
{
"operations": [
{
"parameters": [
{
import sqlite3
import threading
db = sqlite3.connect(":memory:", check_same_thread=False)
CREATE_NON_LINKED_TABLE = 'CREATE TABLE IF NOT EXISTS %s (id INTEGER PRIMARY KEY AUTOINCREMENT, original, cleaned, UNIQUE(original))'
CREATE_LINKED_TABLE = 'CREATE TABLE IF NOT EXISTS %s (id INTEGER PRIMARY KEY AUTOINCREMENT, original, cleaned, study INTEGER, UNIQUE(original, study), FOREIGN KEY(study) REFERENCES studyinstanceuid(id))'
db.isolation_level = None
db.execute(CREATE_NON_LINKED_TABLE % 'studyinstanceuid')
db.execute(CREATE_LINKED_TABLE % 'patientsname')