VISION-SJTU / RECCE

[CVPR2022] End-to-End Reconstruction-Classification Learning for Face Forgery Detection
MIT License
103 stars 14 forks source link

would you provide pre-train model #17

Closed Pudge-tao closed 1 year ago

Pudge-tao commented 1 year ago

in closed issues, i have only found FF++ dataset pickle, can u provide your pre-train model ("best_model.bin"). when running the code to test,i got errors that means “theres no model file”。thanks a lot image image

Zz-ww commented 1 year ago

我也遇到了同样的问题

XJay18 commented 1 year ago

Hi, sorry for the late reply. The provided RECCE weighs are the model parameters which could be used for testing. The 'bin' file is just used for debugging which contains some additional information.

You can convert the provided RECCE weights stored in 'pickle' file to 'bin' file using the code below.

import torch
import argparse

def arg_parser():
    parser = argparse.ArgumentParser(description="pickle2bin utility")
    parser.add_argument("--path", "-p",
                        type=str,
                        required=True,
                        help="Specify the path of the pickle file to "
                             "translate into bin file.")
    return parser.parse_args()

if __name__ == '__main__':
    arg = arg_parser()

    print(f"Loading pickle file from '{arg.path}'.")
    model_params = torch.load(arg.path, map_location="cpu")

    torch.save({
        "model": model_params,
        "step": -1,
        "best_step": -1,
        "best_metric": torch.tensor(-1.),
        "eval_metric": "Unknown"
    }, arg.path.replace(".pickle", ".bin"))
    print(f"Converted pickle file to bin file stored in "
          f"'{arg.path.replace('.pickle', '.bin')}'.")

Supposed you have named the above code as pickle2bin.py, you can run

python pickle2bin.py --path model_params_ffpp_c40.pickle

to translate the 'pickle' weights into 'bin' file for testing. Please also note that you may need to modify the value of config/ckpt in the model configuration file, ie, replace the default value best_model_1000 to model_params_ffpp_c40.

Pudge-tao commented 1 year ago

我也遇到了同样的问题

太难了

Hi, sorry for the late reply. The provided RECCE weighs are the model parameters which could be used for testing. The 'bin' file is just used for debugging which contains some additional information.

You can convert the provided RECCE weights stored in 'pickle' file to 'bin' file using the code below.

import torch
import argparse

def arg_parser():
    parser = argparse.ArgumentParser(description="pickle2bin utility")
    parser.add_argument("--path", "-p",
                        type=str,
                        required=True,
                        help="Specify the path of the pickle file to "
                             "translate into bin file.")
    return parser.parse_args()

if __name__ == '__main__':
    arg = arg_parser()

    print(f"Loading pickle file from '{arg.path}'.")
    model_params = torch.load(arg.path, map_location="cpu")

    torch.save({
        "model": model_params,
        "step": -1,
        "best_step": -1,
        "best_metric": torch.tensor(-1.),
        "eval_metric": "Unknown"
    }, arg.path.replace(".pickle", ".bin"))
    print(f"Converted pickle file to bin file stored in "
          f"'{arg.path.replace('.pickle', '.bin')}'.")

Supposed you have named the above code as pickle2bin.py, you can run

python pickle2bin.py --path model_params_ffpp_c40.pickle

to translate the 'pickle' weights into 'bin' file for testing. Please also note that you may need to modify the value of config/ckpt in the model configuration file, ie, replace the default value best_model_1000 to model_params_ffpp_c40.

thanks a lot,It helps me a lot

thanks a lot, it helps me a lot

ucalyptus2 commented 1 year ago

@Pudge-tao what is the name of the pickle file and where to find it?

ats4869 commented 4 months ago

@Pudge-tao what is the name of the pickle file and where to find it?

chat18.aichatos.xyz/#/chat/1698070039905