woodrush / neural-art-tf

"A neural algorithm of Artistic style" in tensorflow
546 stars 113 forks source link

Converting model on Windows doesn't work. #5

Open PAK90 opened 7 years ago

PAK90 commented 7 years ago

On Windows 10 and using TF 0.12, using Python 3.5.2 to run python ./kaffe/kaffe.py and the illust2vec model and prototext gives me this error:

  File "./kaffe/kaffe.py", line 14
    print "scope:", key
                 ^
SyntaxError: Missing parentheses in call to 'print'

Running it with Python 2 instead doesn't let me import Tensorflow since on Windows only Py3.5 can be used.

I fixed the print statement manually, and got a new and exciting error:

WARNING: PyCaffe not found!
Falling back to protocol buffer implementation.
This may take a couple of minutes.
Traceback (most recent call last):
  File "./kaffe/kaffe.py", line 29, in load
    self.load_using_caffe()
  File "./kaffe/kaffe.py", line 37, in load_using_caffe
    import caffe
ImportError: No module named 'caffe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\internal\python_message.py", line 1087, in MergeFromString
    if self._InternalParse(serialized, 0, length) != length:
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\internal\python_message.py", line 1109, in InternalParse
    (tag_bytes, new_pos) = local_ReadTag(buffer, pos)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\internal\decoder.py", line 181, in ReadTag
    while six.indexbytes(buffer, pos) & 0x80:
TypeError: unsupported operand type(s) for &: 'str' and 'int'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./kaffe/kaffe.py", line 104, in <module>
    main()
  File "./kaffe/kaffe.py", line 101, in main
    CaffeDataReader(def_path, data_path).dump(dst_path)
  File "./kaffe/kaffe.py", line 25, in __init__
    self.load()
  File "./kaffe/kaffe.py", line 34, in load
    self.load_using_pb()
  File "./kaffe/kaffe.py", line 43, in load_using_pb
    import caffepb
  File "C:\Users\User\Documents\tensorFlowExp\neural-art-tf\kaffe\caffepb.py", line 712, in <module>
    options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001')),
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\descriptor.py", line 869, in _ParseOptions
    message.ParseFromString(string)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\message.py", line 185, in ParseFromString
    self.MergeFromString(serialized)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\google\protobuf\internal\python_message.py", line 1093, in MergeFromString
    raise message_mod.DecodeError('Truncated message.')
google.protobuf.message.DecodeError: Truncated message.

Your docs specifically say Caffe isn't required, but this error message is misleading in that it pretends that it is (checking the code reveals that it isn't). Seems that the load_using_pb() function is also throwing an error, presumably due to Python 3.