Giter Club home page Giter Club logo

Comments (5)

mchong6 avatar mchong6 commented on May 10, 2024

Only one style image is needed. This issue looks like when your style image is a png with 4 channels. The align face code seems to have issues with that. Can you paste the entire error you got so I know which line is causing this? Alternatively try another style image.

from jojogan.

onzie9 avatar onzie9 commented on May 10, 2024

Here is the full error. Note that img.shape from opencv indicates the image is 3 channel.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-22-1fb6e2251d67> in <module>()
     18 for name in names:
     19     style_path = f'style_images_aligned/{strip_path_extension(name)}.png'
---> 20     style_image = transform(Image.open(style_path))
     21     style_images.append(style_image)
     22 

3 frames
/usr/local/lib/python3.7/dist-pack
![Screen Shot 2022-01-10 at 5 00 21 PM](https://user-images.githubusercontent.com/10655590/148787707-921bdd2b-edbc-49a7-92d3-050402671a78.png)
ages/torchvision/transforms/functional.py in normalize(tensor, mean, std, inplace)
    349     if std.ndim == 1:
    350         std = std.view(-1, 1, 1)
--> 351     tensor.sub_(mean).div_(std)
    352     return tensor
    353 

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

from jojogan.

onzie9 avatar onzie9 commented on May 10, 2024

Screen Shot 2022-01-10 at 5 00 21 PM

from jojogan.

mchong6 avatar mchong6 commented on May 10, 2024

Try doing this

style_image = transform(Image.open(style_path).convert("RGB")

I actually am not sure why this is happening, I kind of assume that if the align face function worked, the resulting PNG image will always be 3 channels. Maybe that assumption is wrong.

from jojogan.

onzie9 avatar onzie9 commented on May 10, 2024

That did it! Thanks.

from jojogan.

Related Issues (20)

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.