ali-vilab / FlashFace

MIT License
343 stars 34 forks source link

how to do Identity Mixing? #5

Open loboere opened 4 months ago

jshilong commented 4 months ago

This code does not implement Identity Mixing. You can implement it by combining two ID results on https://github.com/ali-vilab/FlashFace/blob/a3afe3f5a6851104ae0895dfdb207cfbdc978ea8/flashface/all_finetune/models/reference_unet.py#L96 and https://github.com/ali-vilab/FlashFace/blob/a3afe3f5a6851104ae0895dfdb207cfbdc978ea8/flashface/all_finetune/models/reference_unet.py#L108

loboere commented 4 months ago

I would implement it but I don't understand what part of the code represents the id

jshilong commented 4 months ago

I would implement it but I don't understand what part of the code represents the id

Thank you very much for your interest in our work. To understand the meaning of these tensors, you may need to set a breakpoint and refer to the article. The ID information is encoded in "ctx". If you want to mix the IDs, you should first obtain "ctx_id1" and "ctx_id2". Then, you can calculate "x" using the following formula:

x = x + (self.self_attn.self_attn_first(y, ctx_id1)) * self.share_cache['similarity'] + (1 - self.share_cache['similarity']) * self.self_attn.self_attn_first(y, ctx_id2)

if you encounter any difficulties, please don't hesitate to ask me for help.

loboere commented 4 months ago

I don't understand how to load two IDs, ctx was generated from y and y from x, I don't know what x is, could you give me some code to load two IDs?

loboere commented 3 months ago

Do you plan to publish the code for Identity Mixing?

jshilong commented 3 months ago

Do you plan to publish the code for Identity Mixing?

Absolutely, this would be a modification to the existing code. I will add this function soon.

loboere commented 2 months ago

It's been a while, please add it as soon as possible

loboere commented 1 month ago

any news?

zimenglan-sysu-512 commented 1 month ago

+1

loboere commented 1 month ago

please @jshilong add it as soon as possible