Advertisement
majczel23000

Untitled

Jun 18th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1.     if iterator%1000 == 0:
  2.         white_img = np.zeros([75,75,3])
  3.         white_img.fill(255)
  4.         white_img = np.expand_dims(white_img, axis=0)
  5.         white_img += gradients * learning_rate
  6.        
  7.         min_pixel_white = white_img.reshape((white_img.shape[1]*white_img.shape[2], 3)).min(axis=0).min()
  8.         max_pixel_white = white_img.reshape((white_img.shape[1]*white_img.shape[2], 3)).max(axis=0).max()
  9.         original_white = white_img[0]
  10.         original_white = (original_white - min_pixel_white) * (255/(max_pixel_white - min_pixel_white))
  11.         im = Image.fromarray(original_white.astype(np.uint8))
  12.         im = im.convert('LA')
  13.         im.save("original_white"+str(iterator)+".png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement