In [1]:
%load_ext autoreload
%autoreload 2
import utils
reload(utils)
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pathnet
import pandas as pd


Using Theano backend.
Using gpu device 0: GeForce GTX TITAN X (CNMeM is enabled with initial size: 95.0% of memory, cuDNN 5110)
/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/__init__.py:600: UserWarning: Your cuDNN version is more recent than the one Theano officially supports. If you see any problems, try updating Theano or downgrading cuDNN to version 5.
  warnings.warn(warn)

In [3]:
ids = [29, 31]
X, sizes = utils.load_images('/root/sharedfolder/360Salient/', ids)

In [14]:
utils.paths_for_images('/root/sharedfolder/360Salient/', ids)


Out[14]:
['/root/sharedfolder/360Salient/Images/P29.jpg',
 '/root/sharedfolder/360Salient/Images/P31.jpg']

In [13]:
i, s = utils.load_image("/root/sharedfolder/360Salient/Images/P29.jpg")
s


Out[13]:
(4444, 8888)

In [23]:
utils.get_duration_fixation()


Out[23]:
1.8628999999999993

In [9]:
print sizes
print sizes[1]
plt.imshow(X[1].transpose((1,2,0)).astype(np.uint8))


[(4444, 8888), (3000, 6000)]
(3000, 6000)
Out[9]:
<matplotlib.image.AxesImage at 0x7f2d25eb3d90>

In [ ]:


In [53]:
import matplotlib.image as mpimg

img =  mpimg.imread("/root/sharedfolder/360Salient/Images/P29.jpg")

In [56]:
size = (img.shape[0], img.shape[1])
size


Out[56]:
(4444, 8888)

In [10]:
img.shape


Out[10]:
(1, 3, 300, 600)

In [19]:
plt.imshow(img[0].transpose((1,2,0)).astype(np.uint8))


Out[19]:
<matplotlib.image.AxesImage at 0x7f947c7ab350>

In [58]:
p = pathnet.predict("/root/sharedfolder/360Salient/Images/P29.jpg")

In [65]:
print pd.DataFrame(p[30:100])


    0   1   2     3     4
0   1  31  30  1599  2222
1   1  32  31  1022   666
2   1  33  32  4132  1851
3   1  34  33  8102  3229
4   1  35  34  8754  1051
5   1  36  35  7999  3095
6   1  37  36  8547  2488
7   1  38  37  8354  2503
8   1  39  38  3658  1199
9   1  40  39  7584  3925
10  1  41  40  6517  1925
11  1  42  41  5999  2858
12  1  43  42  5747  3318
13  2   1   0  2473  1377
14  2   2   1  1703  3081
15  2   3   2   311  1836
16  2   4   3  2888   962
17  2   5   4  1466  2207
18  2   6   5  2488   962
19  2   7   6  2296  1288
20  2   8   7  3777  1940
21  2   9   8  6280  1659
22  2  10   9  7125  2296
23  2  11  10  5451   903
24  2  12  11  5777  1081
25  2  13  12   622  2710
26  2  14  13  2310  2088
27  3   1   0  6428  3244
28  3   2   1  8191  1377
29  3   3   2  8295     0
.. ..  ..  ..   ...   ...
40  3  14  13   192  2014
41  3  15  14  2607   162
42  3  16  15   948  1259
43  3  17  16  3288   755
44  3  18  17  3214  2355
45  3  19  18  2933  2858
46  3  20  19  1540  1999
47  3  21  20  1777  3051
48  3  22  21  2755     0
49  3  23  22  2518  1688
50  3  24  23  3184  2133
51  3  25  24  4132  3333
52  3  26  25  2829  2147
53  3  27  26  4488  1466
54  3  28  27  6903  1348
55  3  29  28  8858  1910
56  3  30  29  7362  2133
57  3  31  30  3036  2844
58  3  32  31  2607  3377
59  3  33  32  2266  2118
60  3  34  33  2651  2459
61  4   1   0  8073   311
62  4   2   1  8858  1036
63  4   3   2  8636  2992
64  4   4   3  6340  1318
65  4   5   4  8502  2251
66  4   6   5  7406  2147
67  4   7   6  8695  2518
68  4   8   7  8813  2118
69  4   9   8  5792   311

[70 rows x 5 columns]

In [ ]:


In [ ]:
def view(fix, frame):
    x,y = map(list, zip(*fix))
    plt.imshow(frame)
    plt.scatter(x,y)
    plt.plot(x,y, '-or', markersize=25, markevery=1000)

In [24]:
pathnet.predict_and_save('/root/sharedfolder/360Salient/', [29, 31], '/root/sharedfolder/360Salient/results/v4/')


Working on image 1 of 2
Saved scanpaths from image /root/sharedfolder/360Salient/Images/P29.jpg in file pred_29.mat
Working on image 2 of 2
Saved scanpaths from image /root/sharedfolder/360Salient/Images/P31.jpg in file pred_31.mat
Done!
Out[24]:
True