DeepFakeIL / DFIL

[ACM MM 2023 ]DFIL Codes
17 stars 0 forks source link

code error help #10

Open ats4869 opened 1 month ago

ats4869 commented 1 month ago

image image

DeepFakeIL commented 1 month ago

some times you need to get the feature of inputs to calculate the distance between different features, sometimes you need to get last output please check it in model file.

ats4869 commented 1 month ago

"Firstly, you should download all datasets including(FF++,DFDC-p,CDF,DFD).

Secondly, you can use file 'train_CNN_SupCon_and_CE.py' to train your first detection model with FF++ dataset.

Thirdly, you can use 'get_feature.py' , 'get_image_info.py' and 'create_memory.py' to construct your memory set.

Finally, you could randomly pick up 25 train video in your new dataset and add them into your memery set to train new model by file 'TaskN_KD.py'.

Thank you for your reply. I followed your instructions and got stuck at the second step. I used the FF++ dataset to create my own train dataset list, but I got stuck at this code. I checked the return x of model.py and found that it only had one output, but there were two outputs, outputs and fc_features. How should I modify this code? What does fc_features refer to? Is it the feature before fc? I used the hook function and it was not the feature before. "谢谢您的回复,我按照您的说明卡在第二步,我使用FF++数据集创建了自己的train数据集list,但是到这这个代码卡住了。我检查model.py的return x 只有一个输出,但是有outputs,fc_features两个输出,请问这个代码应该怎么修改,fc_features指的是什么?是fc之前的特征吗,我使用hook函数也不是之前的特征

DeepFakeIL commented 1 month ago

In xception.py you can find following codes:

def logits(self, features):
    x = self.relu(features)

    x = F.adaptive_avg_pool2d(x, (1, 1)) 
    x = x.view(x.size(0), -1)
    x = self.last_linear(x)
    return x

def forward(self, input):
    x = self.features(input)
    x = self.logits(x)
    return x

you could modify it to: def logits(self, features): x = self.relu(features)

    x = F.adaptive_avg_pool2d(x, (1, 1)) 
    x = x.view(x.size(0), -1)
    x = self.last_linear(x)
    return x

def forward(self, input):
    x = self.features(input)
    fc  = x
    x = self.logits(x)
    return x,fc
DeepFakeIL commented 1 month ago

you also need to modify it in train file, output_y, output_fc = model(input)

ats4869 commented 1 month ago

Thank you for your help. I modified the exception and solved the problem. It can run normally without modifying train.py.、 谢谢你的帮助,我对xception进行了修改解决了问题。在train.py没有修改也可以正常进行运行。