Open xiaoerjason opened 1 year ago
----------------- Options ---------------
aspect_ratio: 1.0
batch_size: 2
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./test_img [default: ./datasets/BCI]
dataset_mode: aligned
direction: AtoB
display_winsize: 256
epoch: latest
eval: False
gpu_ids: 0
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None]
load_iter: 0 [default: 0]
load_size: 320
max_dataset_size: inf
model: pix2pix
n_layers_D: 3
name: pyramidpix2pix
ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: False
no_flip: False
norm: batch
num_test: 1000
num_threads: 4
output_nc: 3
pattern: L1_L2_L3_L4
phase: test
preprocess: scale_width_and_midcrop
results_dir: ./results/
serial_batches: False
suffix:
verbose: False
----------------- End -------------------
这可能是pytorch版本和模型不匹配造成的。我们使用的pytorch版本为1.9.0,您可以使用和我们一样的版本测试一下。
@xiaoerjason , @SantJay hello I have the exact same problem I am using PyTorch 1.9.0 but the error is exactly the same!
I have tried everything but I can't generate images using pre-trained model here is the exact issue:
----------------- Options ---------------
aspect_ratio: 1.0
batch_size: 2
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./datasets/BCI
dataset_mode: aligned
direction: AtoB
display_winsize: 256
epoch: latest
eval: False
gpu_ids: -1
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None]
load_iter: 0 [default: 0]
load_size: 320
max_dataset_size: inf
model: pix2pix
n_layers_D: 3
name: pyramidpix2pix
ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: False
no_flip: False
norm: batch
num_test: 1000
num_threads: 4
output_nc: 3
pattern: L1_L2_L3_L4
phase: test
preprocess: scale_width_and_midcrop
results_dir: ./results/
serial_batches: False
suffix:
verbose: False
----------------- End -------------------
dataset [AlignedDataset] was created
initialize network with normal
model [Pix2PixModel] was created
loading the model from ./checkpoints\pyramidpix2pix\latest_net_G.pth
Traceback (most recent call last):
File "test.py", line 47, in
@arsham-khafan , @SantJay ,@xiaoerjason, @bupt-ai-cz Can you set the netG parameter in base_options to "attention_unet_32"? The weights file provided by the author is actually for "attention_unet_32", not "resnet_9blocks".
@ittong Genius! it worked, thank you so much @SantJay please update the read me file and note that the netG must be "attention_unet_32"
当我使用预训练模型进行推理的时候发生了错误: torch.nn.modules.module.ModuleAttributeError: 'Sequential' object has no attribute 'model'