Google+ Photos is one of the most advanced, easily accessable, image recognition projects I have found online. The interested reader might want to learn more at Android Police or Mashable.
This feature was quite tempting to me when I heard of it, and I decided to upload my entire photo archive of about 3,000 photos to google plus. (All on private settings, only I can see them, and I took all of the photos, they have not existed on the internet anywhere else) I take a lot of cat photos.
To see this, lets first look at the top 5 results for cats.
In [16]:
%pylab inline
from scipy.signal import correlate2d
cats = []
not_cats = []
cats.append( imread('imgs/cats/1.png') )
cats.append( imread('imgs/cats/2.png') )
cats.append( imread('imgs/cats/3.png') )
cats.append( imread('imgs/cats/4.png') )
cats.append( imread('imgs/cats/5.png') )
not_cats.append( imread('imgs/notcats/1.png') )
not_cats.append( imread('imgs/notcats/2.png') )
not_cats.append( imread('imgs/notcats/3.png') )
not_cats.append( imread('imgs/notcats/4.png') )
not_cats.append( imread('imgs/notcats/5.png') )
plt.imshow(cats[0])
Out[16]:
In [17]:
plt.imshow(cats[1])
Out[17]:
In [18]:
plt.imshow(cats[2])
Out[18]:
In [19]:
plt.imshow(cats[3])
Out[19]:
In [20]:
plt.imshow(cats[4])
Out[20]:
Three of the top results for 'cat' are actually photos of the back of my dog. Now for the top 5 image recognition images for the query 'not cat'.
In [21]:
plt.imshow(not_cats[0])
Out[21]:
In [22]:
plt.imshow(not_cats[1])
Out[22]:
In [23]:
plt.imshow(not_cats[2])
Out[23]:
In [24]:
plt.imshow(not_cats[3])
Out[24]:
In [25]:
plt.imshow(not_cats[4])
Out[25]:
This time the result is five photos of cats. Three photos of my cat, and two photos of my brother's cat, which is somewhat similar to my cat... How does this correspond to a not cat?
In [26]:
not_cats[0] = not_cats[0].astype(float).sum(axis=-1)/3
not_cats[0] = where(not_cats[0] > 0.8, 1, -1)
imshow(not_cats[0], cmap=cm.gray, interpolation='nearest')
Out[26]:
In [27]:
not_cats[1] = not_cats[1].astype(float).sum(axis=-1)/3
not_cats[1] = where(not_cats[1] > 0.8, 1, -1)
imshow(not_cats[1], cmap=cm.gray, interpolation='nearest')
Out[27]:
In [ ]:
cc = correlate2d( not_cats[0], not_cats[1] )
imshow(cc)
colorbar()
gcf().set_figheight(8)
In [0]: