Giter Club home page Giter Club logo

Comments (7)

vigneshchandar avatar vigneshchandar commented on May 27, 2024 1

For the weight file, I'd downloaded, the encoding was in 'latin1' format.

Try passing encoding='latin1' when loading the file.
torch.load(weight_file_path, map_location=torch.device('cpu'), encoding='latin1')

from portraitnet.

ypw1996 avatar ypw1996 commented on May 27, 2024

Hello, I meet the same problem. Have you fixed it?

from portraitnet.

Novaal avatar Novaal commented on May 27, 2024

You don't need to extract them. Just rename them accordingly to the used config file: e.g myexp/mobilenetv2_video_total/single_224_without_group/model_best.pth.tar.

from portraitnet.

NhatRio avatar NhatRio commented on May 27, 2024

Hi @dong-x16 , Thanks a lot for your impressive work.
I got an error while loading the pre-trained model. Specifically, it was at "checkpoint_video = torch.load(bestModelFile)" in the file VideoTest.ipynb. Here is the error:

    53 if os.path.isfile(bestModelFile):
---> 54     checkpoint_video = torch.load(bestModelFile)
     55     netmodel_video.load_state_dict(checkpoint_video['state_dict'])
     56     print ("minLoss: ", checkpoint_video['minLoss'], checkpoint_video['epoch'])

1 frames
/usr/local/lib/python3.6/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    763     unpickler = pickle_module.Unpickler(f, **pickle_load_args)
    764     unpickler.persistent_load = persistent_load
--> 765     result = unpickler.load()
    766 
    767     deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte   

Do you think this problem caused by the file "model_best.pth.tar"?

Have a nice day!

Nhat

from portraitnet.

gruossomonica avatar gruossomonica commented on May 27, 2024

Hi,
I get a similar error when I load the model mobilenetv2_total_with_prior_channel.tar in VideoTest.ipynb.
I changed the model_root and the model filename accordingly with my folders and files.

---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-13-0ef5f99e810e> in <module>
     51 bestModelFile = os.path.join(exp_args.model_root, 'mobilenetv2_total_with_prior_channel.tar')
     52 if os.path.isfile(bestModelFile):
---> 53     checkpoint_video = torch.load(bestModelFile)
     54     netmodel_video.load_state_dict(checkpoint_video['state_dict'])
     55     print ("minLoss: ", checkpoint_video['minLoss'], checkpoint_video['epoch'])

~\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module)
    366         f = open(f, 'rb')
    367     try:
--> 368         return _load(f, map_location, pickle_module)
    369     finally:
    370         if new_fd:

~\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py in _load(f, map_location, pickle_module)
    540     unpickler = pickle_module.Unpickler(f)
    541     unpickler.persistent_load = persistent_load
--> 542     result = unpickler.load()
    543 
    544     deserialized_storage_keys = pickle_module.load(f)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb7 in position 3: ordinal not in range(128)

Looking forward to your reply.
Best regards.

Monica Gruosso

from portraitnet.

shivSD avatar shivSD commented on May 27, 2024

as per requirement you need to use python 2.7 not 3.x

from portraitnet.

DAVID-Hown avatar DAVID-Hown commented on May 27, 2024

Hello, have you solved it? I found a decompression error after downloading the model file。

from portraitnet.

Related Issues (14)

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.