sh1newu / SepMark

SepMark: Deep Separable Watermarking for Unified Source Tracing and Deepfake Detection
36 stars 7 forks source link

ModuleNotFoundError: No module named 'models' #5

Open jinzhi666 opened 9 months ago

jinzhi666 commented 9 months ago

I have a problem. How can I solve it?

python Dual_Mark_main.py
Setting up [LPIPS] perceptual loss: trunk [alex], v[0.1], spatial [off]
Loading model from: /home/admin/miniconda3/envs/torch_1_12_admin/lib/python3.8/site-packages/lpips/weights/v0.1/alex.pth
SEAttention
SEAttention
SEAttention
SEAttention
SEAttention
SEAttention
SEAttention
SEAttention
------------ Options -------------
Arc_path: arcface_model/arcface_checkpoint.tar
aspect_ratio: 1.0
batchSize: 8
checkpoints_dir: ./checkpoints
cluster_path: features_clustered_010.npy
crop_size: 512
data_type: 32
dataroot: ./datasets/cityscapes/
display_winsize: 512
engine: None
export_onnx: None
feat_num: 3
fineSize: 512
fp16: False
gpu_ids: [0]
how_many: 50
id_thres: 0.03
image_size: 224
input_nc: 3
instance_feat: False
isTrain: False
label_feat: False
label_nc: 0
latent_size: 512
loadSize: 1024
load_features: False
local_rank: 0
max_dataset_size: inf
multisepcific_dir: ./demo_file/multispecific
nThreads: 2
n_blocks_global: 6
n_blocks_local: 3
n_clusters: 10
n_downsample_E: 4
n_downsample_global: 3
n_local_enhancers: 1
name: people
nef: 16
netG: global
ngf: 64
niter_fix_global: 0
no_flip: False
no_instance: False
no_simswaplogo: False
norm: batch
norm_G: spectralspadesyncbatch3x3
ntest: inf
onnx: None
output_nc: 3
output_path: ./output/
phase: test
pic_a_path: G:/swap_data/ID/elon-musk-hero-image.jpeg
pic_b_path: ./demo_file/multi_people.jpg
pic_specific_path: ./crop_224/zrf.jpg
resize_or_crop: scale_width
results_dir: ./results/
semantic_nc: 3
serial_batches: False
temp_path: ./temp_results
tf_log: False
use_dropout: False
use_encoded_image: False
use_mask: False
verbose: False
video_path: G:/swap_data/video/HSB_Demo_Trim.mp4
which_epoch: latest
-------------- End ----------------
netArc_checkpoint arcface_model/arcface_checkpoint.tar
Traceback (most recent call last):
  File "Dual_Mark_main.py", line 193, in <module>
    main()
  File "Dual_Mark_main.py", line 61, in main
    network = Network(message_length, noise_layers_R, noise_layers_F, device, batch_size, lr, beta1, attention_encoder, attention_decoder, weight)
  File "/home/admin/code/watermarking/SepMark/network/Dual_Mark.py", line 26, in __init__
    self.encoder_decoder = DW_EncoderDecoder(message_length, noise_layers_R, noise_layers_F, attention_encoder, attention_decoder).to(device)
  File "/home/admin/code/watermarking/SepMark/network/DW_EncoderDecoder.py", line 16, in __init__
    self.noise = Random_Noise(noise_layers_R + noise_layers_F, len(noise_layers_R), len(noise_layers_F))
  File "/home/admin/code/watermarking/SepMark/network/Random_Noise.py", line 10, in __init__
    layers[i] = eval(layers[i])
  File "<string>", line 1, in <module>
  File "/home/admin/code/watermarking/SepMark/network/noise_layers/simswap/test_one_image.py", line 34, in __init__
    self.model = create_model(opt)
  File "/home/admin/code/watermarking/SepMark/network/noise_layers/simswap/models/models.py", line 14, in create_model
    model.initialize(opt)
  File "/home/admin/code/watermarking/SepMark/network/noise_layers/simswap/models/fs_model.py", line 65, in initialize
    netArc_checkpoint = torch.load(netArc_checkpoint, map_location=torch.device("cpu"))
  File "/home/admin/miniconda3/envs/torch_1_12_admin/lib/python3.8/site-packages/torch/serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/home/admin/miniconda3/envs/torch_1_12_admin/lib/python3.8/site-packages/torch/serialization.py", line 1049, in _load
    result = unpickler.load()
  File "/home/admin/miniconda3/envs/torch_1_12_admin/lib/python3.8/site-packages/torch/serialization.py", line 1042, in find_class
    return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'models'
sh1newu commented 9 months ago

It is suggested to try our re-saved arcface_checkpoint.tar, which can be downloaded from Google Drive, to prevent this issue that may be caused by the paths.

jinzhi666 commented 9 months ago

Thank you. I've solved the problem. This is a relative path problem, simswap can't find the models folder. Place the simswap models in the root directory.

SepMark
    models
    network
        noise_layers
            simswap
                models
JusticeByLu commented 2 months ago

Hello, may I ask how you started the project? I downloaded the dataset from the link, but it always shows that 168125.png cannot be found when executed, and the path included in the code does not include this image. If I add this image, it will show that I cannot find another image, and so on.