svhn_stream.get_epoch_iterator() x = T.fmatrix("features") batch_size = T.iscalar("batch_size") center_y, center_x, deltaY, deltaX = locator.find(x, batch_size) do_sample = theano.function( [x, batch_size], outputs=[center_y, center_x, deltaY, deltaX], allow_input_downcast=True ) overlap = 0.0 distance = 0.0 for i in range(0, num_examples): image = svhn_stream.get_data() half_x = image[3][n_iter - 1] / 2 * (N - 1) * (img_width - 1) half_y = image[4][n_iter - 1] / 2 * (N - 1) * (img_height - 1) x1 = image[1][n_iter - 1] * (img_width - 1) - half_x y1 = image[2][n_iter - 1] * (img_height - 1) - half_y w1 = 2 * half_x h1 = 2 * half_y if not evaluation: im = image[0].reshape([3, img_height, img_width]) * 255 im = im.transpose([1, 2, 0]).astype("uint8") im = Image.fromarray(im, "RGB") draw = ImageDraw.Draw(im) draw.rectangle([(x1, y1), (x1 + w1, y1 + h1)], outline=(0, 255, 0))