This file contains hidden or 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
# boxes are numbered from 1 to 100 (hence all the +1...) | |
import random | |
prisoners=24 | |
attempts=prisoners//2 | |
DEBUG = True | |
This file contains hidden or 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 trim_border(base_img, th=255, m=(1, 1, 1, 1)): | |
if not isinstance(m, tuple): | |
m = (m, m, m, m) | |
if base_img.size == 0: | |
return base_img, [0,0,0,0] | |
img = base_img |
This file contains hidden or 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 sys | |
import time | |
import cv2 | |
import numpy as np | |
''' | |
Based on this code by Abid Rahman K: | |
https://dsp.stackexchange.com/questions/2564/opencv-c-connect-nearby-contours-based-on-distance-between-them |
This file contains hidden or 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
#!/usr/bin/env th | |
-- | |
-- Outputs the number of parameters in a network for a single image | |
-- in evaluation mode. | |
require 'torch' | |
require 'nn' | |
require 'dpnn' | |
-- binary to ascii |
This file contains hidden or 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
double learningRate = 0.01; | |
int numHiddenNodes = 64*2; | |
int numInnerNodes = 32; | |
int numOutputs = 2; | |
double regularization = 0.1; | |
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() | |
.seed(seed) | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) |