(num_samples,
                           sess,
                           dataset_name,
                           batch_size,
                           seed=0,
                           verbose=True,
                           feat_file=None,
                           log_dir='./log')
return real_feat
Reads the image data and compute the real image features.

    Args:
        num_samples (int): Number of real images to compute features.
        sess (Session): TensorFlow session to use.
        dataset_name (str): The name of the dataset to load.
        batch_size (int): The batch size to feedforward for inference.
        feat_file (str): The features file to load from if there is already one.
        verbose (bool): If True, prints progress of computation.
        log_dir (str): Directory where features can be stored.

    Returns:
        ndarray: Inception features of real images.
Reads the image data and compute the real image features.
Reads the image data and compute the real image features .
def compute_real_dist_feat(num_samples,
                           sess,
                           dataset_name,
                           batch_size,
                           seed=0,
                           verbose=True,
                           feat_file=None,
                           log_dir='./log'):
    """
    Reads the image data and compute the real image features.

    Args:
        num_samples (int): Number of real images to compute features.
        sess (Session): TensorFlow session to use.
        dataset_name (str): The name of the dataset to load.
        batch_size (int): The batch size to feedforward for inference.
        feat_file (str): The features file to load from if there is already one.
        verbose (bool): If True, prints progress of computation.
        log_dir (str): Directory where features can be stored.

    Returns:
        ndarray: Inception features of real images.
    """
    # Create custom feat file name
    if feat_file is None:
        feat_dir = os.path.join(log_dir, 'metrics', 'kid', 'features')
        if not os.path.exists(feat_dir):
            os.makedirs(feat_dir)

        feat_file = os.path.join(
            feat_dir,
            "kid_feat_{}_{}k_run_{}.npz".format(dataset_name,
                                                num_samples // 1000, seed))

    if feat_file and os.path.exists(feat_file):
        print("INFO: Loading existing features for real images...")
        f = np.load(feat_file)
        real_feat = f['feat'][:]
        f.close()

    else:
        # Obtain the numpy format data
        print("INFO: Obtaining images...")
        images = get_dataset_images(dataset_name, num_samples=num_samples)

        # Compute the mean and cov
        print("INFO: Computing features for real images...")
        real_feat = inception_utils.get_activations(images=images,
                                                    sess=sess,
                                                    batch_size=batch_size,
                                                    verbose=verbose)

        print("INFO: Saving features for real images...")
        np.savez(feat_file, feat=real_feat)

    return real_feat
def compute_real_dist_feat ( num_samples , sess , dataset_name , batch_size , seed = 0 , verbose = True , feat_file = None , log_dir = './log' ) : # Create custom feat file name if feat_file is None : feat_dir = os . path . join ( log_dir , 'metrics' , 'kid' , 'features' ) if not os . path . exists ( feat_dir ) : os . makedirs ( feat_dir ) feat_file = os . path . join ( feat_dir , "kid_feat_{}_{}k_run_{}.npz" . format ( dataset_name , num_samples // 1000 , seed ) ) if feat_file and os . path . exists ( feat_file ) : print ( "INFO: Loading existing features for real images..." ) f = np . load ( feat_file ) real_feat = f [ 'feat' ] [ : ] f . close ( ) else : # Obtain the numpy format data print ( "INFO: Obtaining images..." ) images = get_dataset_images ( dataset_name , num_samples = num_samples ) # Compute the mean and cov print ( "INFO: Computing features for real images..." ) real_feat = inception_utils . get_activations ( images = images , sess = sess , batch_size = batch_size , verbose = verbose ) print ( "INFO: Saving features for real images..." ) np . savez ( feat_file , feat = real_feat ) return real_feat