(netG,
                          num_samples,
                          sess,
                          device,
                          seed,
                          batch_size,
                          print_every=20,
                          verbose=True)
return fake_feat
Directly produces the images and convert them into numpy format without
    saving the images on disk.

    Args:
        netG (Module): Torch Module object representing the generator model.
        num_samples (int): The number of fake images for computing features.
        sess (Session): TensorFlow session to use.
        device (str): Device identifier to use for computation.
        seed (int): The random seed to use.
        batch_size (int): The number of samples per batch for inference.
        print_every (int): Interval for printing log.
        verbose (bool): If True, prints progress.

    Returns:
        ndarray: Inception features of generated images.
Directly produces the images and convert them into numpy format without
    saving the images on disk.
Directly produces the images and convert them into numpy format without saving the images on disk .
def compute_gen_dist_feat(netG,
                          num_samples,
                          sess,
                          device,
                          seed,
                          batch_size,
                          print_every=20,
                          verbose=True):
    """
    Directly produces the images and convert them into numpy format without
    saving the images on disk.

    Args:
        netG (Module): Torch Module object representing the generator model.
        num_samples (int): The number of fake images for computing features.
        sess (Session): TensorFlow session to use.
        device (str): Device identifier to use for computation.
        seed (int): The random seed to use.
        batch_size (int): The number of samples per batch for inference.
        print_every (int): Interval for printing log.
        verbose (bool): If True, prints progress.

    Returns:
        ndarray: Inception features of generated images.
    """
    batch_size = min(num_samples, batch_size)

    # Set model to evaluation mode
    netG.eval()

    # Collect num_samples of fake images
    images = []

    # Collect all samples
    start_time = time.time()
    for idx in range(num_samples // batch_size):
        fake_images = netG.generate_images(num_images=batch_size).numpy()

        # Collect fake image
        images.append(fake_images)

        # Print some statistics
        if (idx + 1) % print_every == 0:
            end_time = time.time()
            print(
                "INFO: Generated image {}/{} [Random Seed {}] ({:.4f} sec/idx)"
                .format(
                    (idx + 1) * batch_size, num_samples, seed,
                    (end_time - start_time) / (print_every * batch_size)))
            start_time = end_time

    # Produce images in the required (N, H, W, 3) format for kid computation
    images = np.concatenate(images, 0)  # Gives (N, 3, H, W) BGR
    images = _normalize_images(images)  # Gives (N, H, W, 3) RGB

    # Compute the kid
    print("INFO: Computing features for fake images...")
    fake_feat = inception_utils.get_activations(images=images,
                                                sess=sess,
                                                batch_size=batch_size,
                                                verbose=verbose)

    return fake_feat
def compute_gen_dist_feat ( netG , num_samples , sess , device , seed , batch_size , print_every = 20 , verbose = True ) : batch_size = min ( num_samples , batch_size ) # Set model to evaluation mode netG . eval ( ) # Collect num_samples of fake images images = [ ] # Collect all samples start_time = time . time ( ) for idx in range ( num_samples // batch_size ) : fake_images = netG . generate_images ( num_images = batch_size ) . numpy ( ) # Collect fake image images . append ( fake_images ) # Print some statistics if ( idx + 1 ) % print_every == 0 : end_time = time . time ( ) print ( "INFO: Generated image {}/{} [Random Seed {}] ({:.4f} sec/idx)" . format ( ( idx + 1 ) * batch_size , num_samples , seed , ( end_time - start_time ) / ( print_every * batch_size ) ) ) start_time = end_time # Produce images in the required (N, H, W, 3) format for kid computation images = np . concatenate ( images , 0 ) # Gives (N, 3, H, W) BGR images = _normalize_images ( images ) # Gives (N, H, W, 3) RGB # Compute the kid print ( "INFO: Computing features for fake images..." ) fake_feat = inception_utils . get_activations ( images = images , sess = sess , batch_size = batch_size , verbose = verbose ) return fake_feat