|
a |
|
b/plot_dsb_roi.py |
|
|
1 |
import cPickle as pickle |
|
|
2 |
import string |
|
|
3 |
import sys |
|
|
4 |
import time |
|
|
5 |
from itertools import izip |
|
|
6 |
import lasagne as nn |
|
|
7 |
import numpy as np |
|
|
8 |
import theano |
|
|
9 |
from datetime import datetime, timedelta |
|
|
10 |
import utils |
|
|
11 |
import logger |
|
|
12 |
import theano.tensor as T |
|
|
13 |
import buffering |
|
|
14 |
from configuration import config, set_configuration |
|
|
15 |
import pathfinder |
|
|
16 |
import utils_plots |
|
|
17 |
|
|
|
18 |
theano.config.warn_float64 = 'raise' |
|
|
19 |
|
|
|
20 |
if len(sys.argv) < 2: |
|
|
21 |
sys.exit("Usage: train.py <configuration_name>") |
|
|
22 |
|
|
|
23 |
config_name = sys.argv[1] |
|
|
24 |
set_configuration('configs_class_dsb', config_name) |
|
|
25 |
|
|
|
26 |
predictions_dir = utils.get_dir_path('analysis', pathfinder.METADATA_PATH) |
|
|
27 |
outputs_path = predictions_dir + '/%s' % config_name |
|
|
28 |
utils.auto_make_dir(outputs_path) |
|
|
29 |
|
|
|
30 |
train_data_iterator = config().train_data_iterator |
|
|
31 |
valid_data_iterator = config().valid_data_iterator |
|
|
32 |
test_data_iterator = config().test_data_iterator |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
print |
|
|
36 |
print 'Data' |
|
|
37 |
print 'n train: %d' % train_data_iterator.nsamples |
|
|
38 |
print 'n validation: %d' % valid_data_iterator.nsamples |
|
|
39 |
print 'n chunks per epoch', config().nchunks_per_epoch |
|
|
40 |
|
|
|
41 |
# use buffering.buffered_gen_threaded() |
|
|
42 |
for (x_chunk_train, y_chunk_train, id_train) in test_data_iterator.generate(): |
|
|
43 |
print id_train |
|
|
44 |
print x_chunk_train.shape |
|
|
45 |
|
|
|
46 |
for i in xrange(x_chunk_train.shape[0]): |
|
|
47 |
pid = id_train[i] |
|
|
48 |
for j in xrange(x_chunk_train.shape[1]): |
|
|
49 |
utils_plots.plot_slice_3d_3axis(input=x_chunk_train[i, j, 0], |
|
|
50 |
pid='-'.join([str(pid), str(j)]), |
|
|
51 |
img_dir=outputs_path, |
|
|
52 |
idx=np.array(x_chunk_train[i, j, 0].shape) / 2) |