How to use the scipy.misc.imsave function in scipy

To help you get started, we’ve selected a few scipy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prannayk / videoMultiGAN / acrcn / step_2_gen_anneal.py View on Github external
def save_visualization(X, nh_nw=(batch_size,2+frames), save_path='../results/%s/sample.jpg'%(sys.argv[4])):
	X = morph(X)
	print(X.shape)
	h,w = X.shape[1], X.shape[2]
	img = np.zeros((h * nh_nw[0], w * nh_nw[1], 3))
	
	for n,x in enumerate(X):
		j = n // nh_nw[1]
		i = n % nh_nw[1]
		img[j*h:j*h+h, i*w:i*w+w, :] = x[:,:,:3]
	np.save("%s.%s"%(save_path.split(".")[0],".npy"), img)
	scipy.misc.imsave(save_path, img)
github MarvinTeichmann / KittiBox / decoder / fastBox.py View on Github external
def log_image(np_img, np_confidences, np_boxes, np_global_step,
                  pred_or_true):

        merged = train_utils.add_rectangles(hyp, np_img, np_confidences,
                                            np_boxes,
                                            use_stitching=True,
                                            rnn_len=hyp['rnn_len'])[0]

        num_images = 10

        filename = '%s_%s.jpg' % \
            ((np_global_step // hyp['logging']['write_iter'])
                % num_images, pred_or_true)
        img_path = os.path.join(hyp['dirs']['output_dir'], filename)

        scp.misc.imsave(img_path, merged)
        return merged
github thierrydumas / autoencoder_based_image_compression / kodak_tensorflow_0.11.0 / test_tools.py View on Github external
"tools/pseudo_visualization/crop_option_2d/crop_center.png".
        The test is successful if the 2nd image
        is a random crop of the 1st image and the
        3rd image is a central crop of the 1st image.
        
        """
        width_crop = 64
        
        luminance_uint8 = numpy.load('tools/pseudo_data/luminances_uint8.npy')[0, :, :, 0]
        crop_0 = tls.crop_option_2d(luminance_uint8,
                                    width_crop,
                                    True)
        crop_1 = tls.crop_option_2d(luminance_uint8,
                                    width_crop,
                                    False)
        scipy.misc.imsave('tools/pseudo_visualization/crop_option_2d/luminance_image.png',
                          luminance_uint8)
        scipy.misc.imsave('tools/pseudo_visualization/crop_option_2d/crop_random.png',
                          crop_0)
        scipy.misc.imsave('tools/pseudo_visualization/crop_option_2d/crop_center.png',
                          crop_1)
github rdevon / BGAN / old / CONT-CELEBA / celeba_big.py View on Github external
def print_images(images, num_x, num_y, file='./'):
    scipy.misc.imsave(file,  # current epoch No.
                      (images.reshape(num_x, num_y, 3, DIM_X, DIM_Y)
                       .transpose(0, 3, 1, 4, 2)
                       .reshape(num_x * DIM_X, num_y * DIM_Y, 3)))
github delta-onera / delta_tb / workspace / isprs_vaihingen / train.py View on Github external
def label_image_saver(image_path, label_image):
    im = labels_to_colors(label_image)
    scipy.misc.imsave(image_path, im)
github nesl / adversarial_genattack / utils.py View on Github external
def save_image(img, path):
    imsave(path, (img+0.5))
github ucbdrive / spc / spn_split / utils.py View on Github external
def visualize2(seg, gt):
    if not os.path.isdir('visualize'):
        os.mkdir('visualize')
    for i in range(seg.shape[0]):
        imsave(os.path.join('visualize', 'step%d.png' % (i+1)), np.concatenate([draw_from_pred(seg[i]), draw_from_pred(gt[i])], 1))
github thoppe / DeepMDMA / smooth_transfer.py View on Github external
for i in tqdm(range(n_iter)):
      _, loss = sess.run([T("vis_op"), T("loss"), ])

    # Save trained variables
    train_vars = sess.graph.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
    params = np.array(sess.run(train_vars), object)

    save(params, f_model)
  
    # Save final image
    images = T("input").eval({t_size: 600})
    img = images[0]
    sess.close()
    
    imsave(f_image, img)
github apple2373 / chainer_stylenet / style_net.py View on Github external
def save_x(img,filename="output.png"):
    img = img.reshape((3,224,224))
    img = np.transpose(img,(1,2,0))
    imsave(filename,img)
github dbuscombe-usgs / dl_landscapes_paper / seabright / retile.py View on Github external
def writeout(tmp, cl, labels, outpath, thres):

   l, cnt = md(cl.flatten())
   l = np.squeeze(l)
   if cnt/len(cl.flatten()) > thres:
      outfile = id_generator()+'.jpg'
      fp = outpath+os.sep+labels[l]+os.sep+outfile
      imsave(fp, tmp)