Beispiel #1
0
# this script contains functions for automating
# the building of the right/wrong dataset

from imports import *
from detector_convnet import build_model

path_img = "/Users/JP/Documents/whale/imgs/"
path_img = "/Users/yc/Downloads/whale/imgs/"

# load model
print("... Loading Convolutional Network ...")
with open(path_img + "select/models/conv_3_3_3_20_2_0.03_0.005_250_200.pkl") as f:
    model = load(f)
predict = build_model(model)

# load training fnames
train = pd.read_csv(path_img + "data/train.csv")
fnames = path_img + "raw/" + train["Image"]

# sliding window parameters
w1, h1 = 600, 400
w2, h2 = 100, 100
window_len, x_step, y_step = 100, 10, 10
nx, ny = (w1 - window_len) / x_step, (h1 - window_len) / y_step

# takes a pic file name, a predict function, and plots probs
def plot_pred(fname, predict):

    t_open = time()

    # slide over each w2*h2 region in steps of x_step, y_step
Beispiel #2
0
	path_img = '/Users/JP/Documents/whale/imgs/'
	# path_img = '/Users/yc/Downloads/whale/imgs/'
	# path_img = '/home/jp/whale/imgs/'

	if sys.argv[1] is not None:
		[path1, path2] = sys.argv[1:3]
	else:
		path1 = 'select/models/conv_3_3_3_20_2_0.03_0.005_250_200.pkl'
		path2 = 'thumbs/models/conv_3_5_5_30_447_0.03_0.005_13_100_0.5.pkl'

	# build models
	from detector_convnet import build_model
	with open(path_img + path1) as f:
		model1 = load(f)
	detector = build_model(model1, viz=False)

	from classify_convnet import build_model
	with open(path_img + path2) as f:
		model2 = load(f)
	classifier = build_model(model2, viz=False)

	# read in data
	submit = pd.read_csv(path_img + 'data/submit.csv')

	# sliding window parameters
	w1,h1 = 600,400
	w2,h2,d2 = 100,100,3
	window_len, x_step, y_step = 100, 10, 10
	nx,ny = (w1-window_len)/x_step, (h1-window_len)/y_step