zllrunning / face-makeup.PyTorch

Lip and hair color editor using face parsing maps.
MIT License
496 stars 149 forks source link

Error IndexError: boolean index did not match indexed array along dimension 0; dimension is 780 but corresponding boolean dimension is 799 #7

Open amitkayal opened 3 years ago

amitkayal commented 3 years ago

Hi,

Getting the following error. Is this due to size mismatch?

Downloading: "https://download.pytorch.org/models/resnet18-5c106cde.pth" to /root/.cache/torch/hub/checkpoints/resnet18-5c106cde.pth 100% 44.7M/44.7M [00:00<00:00, 307MB/s] Traceback (most recent call last): File "makeup.py", line 86, in image = hair(image, parsing, part, color) File "makeup.py", line 54, in hair changed[parsing != part] = image[parsing != part] IndexError: boolean index did not match indexed array along dimension 0; dimension is 780 but corresponding boolean dimension is 799

amitkayal commented 3 years ago

Here is the input file girl-no-makeup

yaroslavmavliutov commented 3 years ago

Hi @amitkayal

You can add np.repeat(parsing[:, :, np.newaxis], 3, axis=2) to hair function. It works

qihuijia commented 1 year ago

Hi @amitkayal

You can add np.repeat(parsing[:, :, np.newaxis], 3, axis=2) to hair function. It works

hi, where should I add this code?