Skip to content

Error occurred when i run demo.py #35

@LongwayX

Description

@LongwayX

Traceback (most recent call last):
File "/mnt/sdb/longwei.xu/PSGAN/demo.py", line 72, in
main()
File "/mnt/sdb/longwei.xu/PSGAN/demo.py", line 57, in main
image, face = inference.transfer(source, reference, with_face=True)
File "/mnt/sdb/longwei.xu/PSGAN/psgan/inference.py", line 33, in transfer
source_input, face, crop_face = self.preprocess(source)
File "/mnt/sdb/longwei.xu/PSGAN/psgan/preprocess.py", line 141, in call
mask = self.face_parse.parse(cv2.resize(np_image, (512, 512)))
File "/mnt/sdb/longwei.xu/PSGAN/faceutils/mask/main.py", line 37, in parse
parsing = torch.nn.functional.embedding(parsing, self.dic)
File "/mnt/sdb/longwei.xu/anaconda3/lib/python3.9/site-packages/torch/nn/functional.py", line 2044, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: 'weight' must be 2-D

parse.shape:
torch.Size([512, 512])
parse
tensor([[ 0, 0, 0, ..., 17, 17, 17],
[ 0, 0, 0, ..., 17, 17, 17],
[ 0, 0, 0, ..., 17, 17, 17],
...,
[17, 17, 17, ..., 16, 16, 16],
[17, 17, 17, ..., 16, 16, 16],
[17, 17, 17, ..., 16, 16, 16]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions