(images, sess, batch_size=50, verbose=True)
return pred_arr
Calculates the activations of the pool_3 layer for all images.

    Args:
        images (ndarray): Numpy array of shape (N, C, H, W) with values ranging
            in the range [0, 255].
        sess (Session): TensorFlow Session object.
        batch_size (int): The batch size to use for inference.
        verbose (bool): If True, prints out logging data for batch inference.

    Returns:
        ndarray: Numpy array of shape (N, 2048) representing the pool3 features from the
        inception model.
Calculates the activations of the pool_3 layer for all images.
Calculates the activations of the pool_3 layer for all images .
def get_activations(images, sess, batch_size=50, verbose=True):
    """
    Calculates the activations of the pool_3 layer for all images.

    Args:
        images (ndarray): Numpy array of shape (N, C, H, W) with values ranging
            in the range [0, 255].
        sess (Session): TensorFlow Session object.
        batch_size (int): The batch size to use for inference.
        verbose (bool): If True, prints out logging data for batch inference.

    Returns:
        ndarray: Numpy array of shape (N, 2048) representing the pool3 features from the
        inception model.

    """
    # Get output layer.
    inception_layer = _get_inception_layer(sess)

    # Inference variables
    batch_size = min(batch_size, images.shape[0])
    num_batches = images.shape[0] // batch_size

    # Get features
    pred_arr = np.empty((images.shape[0], 2048))
    for i in range(num_batches):
        start_time = time.time()

        start = i * batch_size
        end = start + batch_size
        batch = images[start:end]
        pred = sess.run(inception_layer,
                        {'inception_model/ExpandDims:0': batch})
        pred_arr[start:end] = pred.reshape(batch_size, -1)

        if verbose:
            print("\rINFO: Propagated batch %d/%d (%.4f sec/batch)" \
                % (i+1, num_batches, time.time()-start_time), end="", flush=True)

    return pred_arr
def get_activations ( images , sess , batch_size = 50 , verbose = True ) : # Get output layer. inception_layer = _get_inception_layer ( sess ) # Inference variables batch_size = min ( batch_size , images . shape [ 0 ] ) num_batches = images . shape [ 0 ] // batch_size # Get features pred_arr = np . empty ( ( images . shape [ 0 ] , 2048 ) ) for i in range ( num_batches ) : start_time = time . time ( ) start = i * batch_size end = start + batch_size batch = images [ start : end ] pred = sess . run ( inception_layer , { 'inception_model/ExpandDims:0' : batch } ) pred_arr [ start : end ] = pred . reshape ( batch_size , - 1 ) if verbose : print ( "\rINFO: Propagated batch %d/%d (%.4f sec/batch)" % ( i + 1 , num_batches , time . time ( ) - start_time ) , end = "" , flush = True ) return pred_arr