alexandonian/ganocracy

Inception Score and FID metrics not working

dylandoblar opened this issue · 0 comments

I’m trying to initialize the IS and FID metrics in the Training.ipynb notebook in gan_training using metrics.calculate_inception_moments and metrics.prepare_inception_metrics but am encountering errors. From a fresh clone of this repo, when running all cells of Training.ipynb up to the cell that computes the inception moments I always observe the following error message

Kernel Restarting
The kernel appears to have died. It will restart automatically.

I added debugging lines to ganocracy/metrics/inception_score.py and split calculate_inception_moments up and found that everything goes smoothly through the loop that populates pool, logits, and labels, but line 364

    pool, logits, labels = [np.concatenate(item, 0) for item in [pool, logits, labels]]

causes an error due to a shape issue: ValueError: zero-dimensional arrays cannot be concatenated (the shapes are pool: (96, 2048); logit: (96, 1000); label: (96,)).

When I comment out that line, however, I have an issue with the following line:

IS_mean, IS_std = calculate_inception_score(logits)

The traceback includes

    257     for index in range(num_splits):
--> 258         pred_chunk = pred[index * (pred.shape[0] // num_splits): (index + 1) * (pred.shape[0] // num_splits), :]
    259         kl_inception = pred_chunk * (np.log(pred_chunk) - np.log(np.expand_dims(np.mean(pred_chunk, 0), 0)))
    260         kl_inception = np.mean(np.sum(kl_inception, 1))

IndexError: too many indices for array

This is because logits is a 1D array whose elements are 2D arrays of shape (96,1000). I'd imagine the concatenate step is intended to make logits the proper shape, but I'm not sure what to do from here. Any help would be appreciated!