import amitgroup as ag import gv import numpy as np originals, bbs = gv.voc.load_object_images_of_size('bicycle', (64, 64), dataset='train') #originals, bbs = gv.voc.load_negative_images_of_size('bicycle', (64, 64), dataset='train', count=1) #print map(lambda x: x.shape, images) #ag.plot.images(images[:9]) for i in xrange(4): import pylab as plt plt.imshow(originals[i], interpolation='nearest') from plotting import plot_box plot_box(bbs[i]) plt.show()
img_padded = ag.util.zeropad(img_resized, (sh[0], sh[1], 0)) print img.shape print img_resized.shape print img_padded.shape small_padded = ag.util.zeropad(small, (sh[0], sh[1], 0)) window = small_padded[sh[0] + offset[0]:sh[0] + offset[0] + sh[0], sh[1] + offset[1]:sh[1] + offset[1] + sh[1]] print window.shape plt.subplot(231) plt.imshow(img) plot_box(box) plt.subplot(232) l1 = plt.imshow(np.ones((1, 1)), vmin=0, vmax=1, cmap=plt.cm.gray, interpolation='nearest') plt.title("Window") plt.subplot(233) l4 = plt.imshow(np.ones((1, 1)), vmin=0, vmax=1, cmap=plt.cm.gray, interpolation='nearest')
img_padded = ag.util.zeropad(img_resized, (sh[0], sh[1], 0)) print img.shape print img_resized.shape print img_padded.shape small_padded = ag.util.zeropad(small, (sh[0], sh[1], 0)) window = small_padded[sh[0] + offset[0] : sh[0] + offset[0] + sh[0], sh[1] + offset[1] : sh[1] + offset[1] + sh[1]] print window.shape plt.subplot(231) plt.imshow(img) plot_box(box) plt.subplot(232) l1 = plt.imshow(np.ones((1, 1)), vmin=0, vmax=1, cmap=plt.cm.gray, interpolation='nearest') plt.title("Window") plt.subplot(233) l4 = plt.imshow(np.ones((1, 1)), vmin=0, vmax=1, cmap=plt.cm.gray, interpolation='nearest') plt.title("Edge visualization") plt.subplot(234) l2 = plt.imshow(np.ones((1, 1)), vmin=0, vmax=1, cmap=plt.cm.RdBu, interpolation='nearest') plt.colorbar() plt.title("Kernel") plt.subplot(235)