# HG changeset patch # User Dumitru Erhan # Date 1265757950 18000 # Node ID 1afa95285b9c3cd6071de35e4ddf3f1143bd24b8 # Parent 7949f46b03e0e9c0134dc4eca6b635565778bf92 fixed small bug related to loading the data - should seek back to the beginning of the file diff -r 7949f46b03e0 -r 1afa95285b9c transformations/pipeline.py --- a/transformations/pipeline.py Tue Feb 09 11:43:09 2010 -0500 +++ b/transformations/pipeline.py Tue Feb 09 18:25:50 2010 -0500 @@ -192,12 +192,16 @@ self.train_data = open(nist_path, 'rb') self.train_labels = open(label_path, 'rb') self.dim = tuple(ft._read_header(self.train_data)[3]) + # in order to seek to the beginning of the file + self.train_data.close() + self.train_data = open(nist_path, 'rb') + def nist_supp_iterator(nist, prob_font, prob_captcha, num_img): subtensor = slice(0, num_img) img = ft.read(nist.train_data, subtensor).astype(numpy.float32)/255 labels = ft.read(nist.train_labels, subtensor) - + for i in xrange(num_img): r = numpy.random.rand() if r<= prob_font: