Mercurial > ift6266
changeset 64:1afa95285b9c
fixed small bug related to loading the data - should seek back to the beginning of the file
author | Dumitru Erhan <dumitru.erhan@gmail.com> |
---|---|
date | Tue, 09 Feb 2010 18:25:50 -0500 |
parents | 7949f46b03e0 |
children | bf83682c827b |
files | transformations/pipeline.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: