All problems
FID Feature Statistics
Problem
Compute the feature statistics used by FID: the mean vector and the covariance matrix (divided by N - 1) of a (num_samples, dim) feature matrix.
The signature is fid_feature_stats(features). Return [mean, covariance].
Hint
FID compares the mean and covariance of real and generated features.
Test cases
case 1
in: [[[1,0],[0,1]]]
expected: [[0.5,0.5],[[0.5,-0.5],[-0.5,0.5]]]
case 2
in: [[[1,2],[3,4],[5,6]]]
expected: [[3,4],[[4,4],[4,4]]]
case 3
in: [[[0,0],[0,0]]]
expected: [[0,0],[[0,0],[0,0]]]
case 4
in: [[[2,1,0],[1,2,3]]]
expected: [[1.5,1.5,1.5],[[0.5,-0.5,-1.5],[-0.5,0.5,1.5],[-1.5,1.5,4.5]]]
Starter codePython
def fid_feature_stats(features):
# Your code here
pass4 test cases · run your code against them in the editor