Giter Site home page Giter Site logo

Comments (3)

romain-rsr avatar romain-rsr commented on July 30, 2024

we were able to download the flower dataset and apply your flower preprocessing file on it, yet when we try to train the file we get this error :

Traceback (most recent call last):
  File "train_gan.py", line 87, in <module>
    generator = model.Generator(dparams).to(device)
  File "x/xingseg/models/generator.py", line 152, in __init__
    if 'celeba' in hyper_paras['class_name'] or 'taichi' in hyper_paras['class_name'] or 'flower' in hyper_paras['class_name'] or 'cub' in hyper_paras['class_name']:
KeyError: 'class_name'

apparently a 'class_name' key was missing from the dict fed into the Generator in train_gan.py :

generator = model.Generator(dparams={   'z_dim': args.z_dim, 
            'n_keypoints': args.n_keypoints, 
            'n_per_kp': args.n_per_kp,
            'n_embedding': args.n_embedding,
            'image_size': args.image_size,
            'feature_map_sizes': args.feature_map_sizes,
            'feature_map_channels': args.feature_map_channels,
            'single_final': args.single_final, 
            'use_linear': args.use_linear,
            'smaller_init_mask': args.smaller_init_mask
}).to(device)

we then added this line in the dict : 'class_name':args.class_name,

but then we got this error :

RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
  File "x/envs/xingseg/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker
    output = module(*input, **kwargs)
  File "x/micromamba/envs/xingseg/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/x/xingseg/models/generator.py", line 298, in forward
    out_batch = self.gen_foreground(out_batch)
  File "/x/xingseg/models/generator.py", line 403, in gen_foreground
    heatmaps = current_kp_mask.unsqueeze(2) * kp_emb.unsqueeze(-1).unsqueeze(-1)
RuntimeError: The size of tensor a (63) must match the size of tensor b (8) at non-singleton dimension 1

Can you please help us to identify the meaning of this size mismatch, and how to resolve it ?

Thanks in advance
Romain

from ganseg.

xingzhehe avatar xingzhehe commented on July 30, 2024

Hi Romain,

Thanks for your interests in our work.

  1. I double checked and did find the files in https://github.com/xingzhehe/GANSeg/tree/main/data/celeba_wild_raw/MAFL. Please ping me again if you cannot find them.

  2. Thanks for the missing keys! I have added it to the file.

  3. As for the mismatch dimensions. I ran the experiments and didn't get any errors. It would be great if you could tell me which hyperparameters you changed. Since pytorch has a weird bug in loading weights, I have to hard code the structure from line 149-225 in models/generator.py as what they were during training, so that it can take the pre-trained weights. I am so sorry for the inconvenience, and wish pytorch to fix that issue soon.

from ganseg.

romain-rsr avatar romain-rsr commented on July 30, 2024

Thanks for your reactivity and these explanations, we were finally able to run the celeba example without any problem.

from ganseg.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.