Skip to content

errors with custom dataset #165

@emoebel

Description

@emoebel

Hello, I managed to train with my custom dataset, organised as follows:

A
|-train
|-val
|-test
B
|-train
|-val
|-test
C
|-train
|-val
|-test

With A containing the images, B containing segmentation maps, and C containing instance maps.

Now I am trying to predict. I tried using the instructions from your main github page: python test.py --name [name_of_experiment] --dataset_mode [dataset_mode] --dataroot [path_to_dataset]

But I get the error: test.py: error: the following arguments are required: --label_dir, --image_dir

So I specified the arguments the script was asking for. But I get the error:

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    model = Pix2PixModel(opt)
  File "/net/serpico-fs2/emoebel/increased/semantic_img_synthesis/SPADE/models/pix2pix_model.py", line 25, in __init__
    self.netG, self.netD, self.netE = self.initialize_networks(opt)
  File "/net/serpico-fs2/emoebel/increased/semantic_img_synthesis/SPADE/models/pix2pix_model.py", line 96, in initialize_networks
    netG = util.load_network(netG, 'G', opt.which_epoch, opt)
  File "/net/serpico-fs2/emoebel/increased/semantic_img_synthesis/SPADE/util/util.py", line 208, in load_network
    net.load_state_dict(weights)
  File "/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SPADEGenerator:
	size mismatch for fc.weight: copying a param with shape torch.Size([1024, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 14, 3, 3]).
	size mismatch for head_0.norm_0.mlp_shared.0.weight: copying a param with shape torch.Size([128, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 14, 3, 3]).
...

Dear developers, could you please make a tutorial on how to use your code with a custom dataset? (and please test it yourself to make sure it works). It would be nice that this tutorial includes how to organise the data folder. This would be very helpful for everybody. I am sure I am not the only one who wants to test your code with custom data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions