Fix exception when training with JPEG compression.

This commit is contained in:
Alex J. Champandard
2016-11-12 15:47:00 +01:00
parent 9d2aa3c436
commit 559e66bbb2
+1 -1
View File
@@ -182,7 +182,7 @@ class DataLoader(threading.Thread):
seed = seed.resize((orig.size[0]//args.zoom, orig.size[1]//args.zoom), resample=PIL.Image.LANCZOS) seed = seed.resize((orig.size[0]//args.zoom, orig.size[1]//args.zoom), resample=PIL.Image.LANCZOS)
if len(args.train_jpeg) > 0: if len(args.train_jpeg) > 0:
buffer, rng = io.BytesIO(), args.train_jpeg[-1] if len(args.train_jpeg) > 1 else 15 buffer, rng = io.BytesIO(), args.train_jpeg[-1] if len(args.train_jpeg) > 1 else 15
seed.save(buffer, format='jpeg', quality=args.train_jpeg+random.randrange(-rng, +rng)) seed.save(buffer, format='jpeg', quality=args.train_jpeg[0]+random.randrange(-rng, +rng))
seed = PIL.Image.open(buffer) seed = PIL.Image.open(buffer)
orig = scipy.misc.fromimage(orig).astype(np.float32) orig = scipy.misc.fromimage(orig).astype(np.float32)