Giter Site home page Giter Site logo

Comments (4)

aaronjolson avatar aaronjolson commented on June 22, 2024

I tried changing https://github.com/dnuffer/large_neural_style/blob/master/vgg19.py#L37 to values = pickle.load(open(weights_filename, encoding="utf8"))['param values'] and I get a slightly different error

Traceback (most recent call last):
  File "large_neural_style.py", line 193, in <module>
    sys.exit(main())
  File "large_neural_style.py", line 129, in main
    args.print_loss)
  File "C:\Users\aaols\Documents\large_neural_style\stylize.py", line 30, in generate_stylized_image
    stylize = Stylize(content, True, style, content_weight, style_weight, style_layer_weight_factor, total_variation_weight, print_loss, print_progress=True)
  File "C:\Users\aaols\Documents\large_neural_style\stylize.py", line 92, in __init__
    self.net.load_params('vgg19_normalized.pkl')
  File "C:\Users\aaols\Documents\large_neural_style\vgg19.py", line 37, in load_params
    values = pickle.load(open(weights_filename, encoding="utf8"))['param values']
  File "C:\Python36\lib\codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

So I am assuming this is some kind of encoding error.

from large_neural_style.

dnuffer avatar dnuffer commented on June 22, 2024

The error is because the weights were pickled with python 2.7 and you're using 3.6. Apparently there's potential incompatibilities. Reading https://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with-python-3 it seems you can try passing encoding="latin1" to pickle.load(), and if that doesn't work, I'd suggest using python 2.7.

from large_neural_style.

dnuffer avatar dnuffer commented on June 22, 2024

Also you can try using encoding='bytes'

from large_neural_style.

aaronjolson avatar aaronjolson commented on June 22, 2024

Ah, I see, thank you!
I changed line 37 to values = pickle.load(open(weights_filename, 'rb'), encoding='latin-1')['param values'] and that has moved me forward.

from large_neural_style.

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.