genforce / idinvert

[ECCV 2020] In-Domain GAN Inversion for Real Image Editing
https://genforce.github.io/idinvert/
MIT License
461 stars 65 forks source link

Some questions for "Semantic Analysis of the Inverted Codes" in the paper? #32

Closed GreenLimeSia closed 3 years ago

GreenLimeSia commented 3 years ago

I want to know how to use boundaries to evaluate the attribute classification performance using the inverted codes? In addition, would you mind sharing this code and the off-the-shelf classifier?

1604922263(1)

1604923013(1)

ShenYujun commented 3 years ago

Given the boundary, you can compute the distance from a code (corresponding to a synthesis) to this boundary, as the data. Meanwhile, you can get the semantic score for the synthesis, as the label. With such data-label pairs, you can draw the precision-recall curve like in the paper.

GreenLimeSia commented 3 years ago

Thanks for your reply! How to compute the distance from a code to an attribute boundary, by using a cos(x)? I think cos(x) maybe perform well since it outputs a score with [0,1], when score=1, only and only if orthogonal. I summary some ideas for evaluating the semantics: 1、Training a classifier that can predict arbitrary image labels, and the predict labels as ground truth. The same idea as your paper. 2、Sampling latent code and generating its corresponding images, and predict that images label. Then we have pairs data (latent code, labels). 3、Obtain a linear model with input latent code and output labels. 4、Using the well-trained linear model to predict inverse code with different methods, compute accuracy between predicting labels and ground truth. What do you think of this idea?

ShenYujun commented 3 years ago
  1. We compute the score between a particular latent code and a semantic boundary with Euclidean distance.

  2. Your pipeline is correct!

GreenLimeSia commented 3 years ago

Thanks for your reply! I will cite your hard work!