In [ ]:
%pylab inline

In [ ]:
%%bash
caffe.bin device_query --gpu 0

In [ ]:
import caffe

In [ ]:
caffe.set_device(0)
caffe.set_mode_gpu()

In [ ]:
pwd

In [ ]:
TEST_IMAGE = '../data/cock-congo/cock/0/0/orthographic.png'

In [ ]:
import skimage.io
data = skimage.io.imread(TEST_IMAGE)
imshow(data);

In [ ]:
from pyfacades.models.driving_12x360x480 import process_strip as segment_sky_and_trees
from pyfacades.util import channels_first, channels_last

In [ ]:
sky_and_trees = segment_sky_and_trees(channels_first(data))

In [ ]:
sky_and_trees.plot()

In [ ]:
imshow(sky_and_trees.building(), cmap=cm.gray)

In [ ]:
imshow(sky_and_trees.sky(), cmap=cm.gray)

In [ ]:
import pyfacades.rectify
H = pyfacades.rectify.Homography(data, mask=sky_and_trees.building()>0.5)

imshow(H.rectified);

The next command may produce a warning -- it includes some plotting functions and in order to run the program without X-windows, I did something hacky. The warning does not matter, it can safely be ignored.


In [ ]:
from pyfacades.models.independant_12_layers.segment import process_strip as segment_facade

In [ ]:
facade_scores = segment_facade(channels_first(255*H.rectified))

In [ ]:
imshow(facade_scores.window())

In [ ]:
imshow(facade_scores.facade_edge())

In [ ]:
num_features, num_labels, num_rows, num_cols = facade_scores.features.shape
print "Width is", num_cols

In [ ]:
column_sums =  facade_scores.facade_edge().sum(axis=0)
fill_between(range(num_cols), column_sums)
hlines(column_sums.mean(), 0, num_cols)
hlines(column_sums.mean()+column_sums.std(), 0, num_cols, linestyles='--')

In [ ]:
from pyfacades.megafacade import MegaFacade

In [ ]:
mf = MegaFacade()

In [ ]:
mf.load_image(TEST_IMAGE)

In [ ]:
mf.plot_facade_cuts()

In [ ]:
mf.plot_grids()

In [ ]:
mf.plot_regions()

In [ ]:
mf.save_params('test.yml')
!head test.yml
print "********SNIP**********"
!tail test.yml

In [ ]: