Puzer / stylegan-encoder

StyleGAN Encoder - converts real images to latent space
Other
1.07k stars 165 forks source link

Getting numpy array of custom feature directions #16

Open Prashant-mahajan opened 5 years ago

Prashant-mahajan commented 5 years ago

Hi, I modified the non-linear model inputs to get different feature directions. How can I get numpy array of those feature vectors for non-linear model? For linear model, I realized it can be obtain by making minor changes here:

clf = LogisticRegression(class_weight='balanced')
clf.fit(X_data.reshape((-1, 18*512)), y_gender_data)
gender_dircetion = clf.coef_.reshape((18, 512))

Thank you!

ghost commented 5 years ago

@Prashant-mahajan how would you get something like 'emotion' 'happiness' for the linear model?

y_emotion_data = np.array([x['faceAttributes']['emotion'] == 'happiness' for x in labels_data])?

Prashant-mahajan commented 5 years ago

Hi @ak9250, apologies for late reply. To get the numpy array of 'happiness' feature you can use y_surprise_data = np.array([x['faceAttributes']['emotion']['surprise'] for x in labels_data]).

@Puzer I'm stuck here, any hint would be appreciated.