Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid protobuf #53

Open
sametucuncu opened this issue Jan 10, 2024 · 12 comments
Open

Invalid protobuf #53

sametucuncu opened this issue Jan 10, 2024 · 12 comments

Comments

@sametucuncu
Copy link

Hello! I am getting this error. It would be appreciated if you could help with the problem.

onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError]: 7: INVALID_PROTOBUF: Load model from assets/face_detector.onnx failed:Protobuf parsing failed.

@adamswsk
Copy link

我也遇到了相同的问题,我用的是python 3.8.10,按照文档安装了依赖,运行main.py的时候报错了,是我的环境有问题么?

@yinguobing
Copy link
Owner

Please check the model file with md5sum

md5sum face_detector.onnx

The output should be

9d44dbc74e862957c4cf3b81294b9c94  face_detector.onnx

If the digest value differs from above, the model file was corrupted. Try clone again, or download directly from github.

@sametucuncu
Copy link
Author

Thank you for your help. You mean download the pretrained model from SCRFD and convert it to onnx file and replace it with the corrupted one.

@adamswsk
Copy link

Thank you for your response. I have verified that the MD5 hash value is correct. Based on sametucuncu's suggestion, I am considering using the pretrained model from SCRFD and converting it to an ONNX file

@sametucuncu
Copy link
Author

Thank you for your response. I have verified that the MD5 hash value is correct. Based on sametucuncu's suggestion, I am considering using the pretrained model from SCRFD and converting it to an ONNX file

Could you please let me know if you could convert the model to onnx file?

@AnthonyLia
Copy link

AnthonyLia commented Feb 5, 2024

I am having this same issue, Windows with Python 3.11 environment.
The first time, face_detector.onnx had an MD5 hash of a117d2bade61178baca5b6fa3163e72a
After redownloading, it's 9d44dbc74e862957c4cf3b81294b9c94

However, I still receive:

 Traceback (most recent call last):
  File "c:\Users\A\Desktop\head-pose-estimation-master\main.py", line 123, in <module>
    run()
  File "c:\Users\A\Desktop\head-pose-estimation-master\main.py", line 49, in run
    mark_detector = MarkDetector("assets/face_landmarks.onnx")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\A\Desktop\head-pose-estimation-master\mark_detection.py", line 20, in __init__
    self.model = ort.InferenceSession(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\A\AppData\Roaming\Python\Python311\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
    self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "C:\Users\A\AppData\Roaming\Python\Python311\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 424, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from assets/face_landmarks.onnx failed:Protobuf parsing failed.

as the traceback, but the 2nd run my console printed:

2 0 2 4 - 0 2 - 0 4   2 1 : 5 5 : 2 5 . 2 5 8 6 1 7 9   [ E : o n n x r u n t i m e : D e f a u l t ,   p r o v i d e r _ b r i d g e _ o r t . c c : 1 3 5 1   o n n x r u n t i m e : : T r y G e t P r o v i d e r I n f o _ C U D A ]   D : \ a \ _ w o r k \ 1 \ s \ o n n x r u n t i m e \ c o r e \ s e s s i o n \ p r o v i d e r _ b r i d g e _ o r t . c c : 1 1 3 1   o n n x r u n t i m e : : P r o v i d e r L i b r a r y : : G e t   [ O N N X R u n t i m e E r r o r ]   :   1   :   F A I L   :   L o a d L i b r a r y   f a i l e d   w i t h   e r r o r   1 2 6   " "   w h e n   t r y i n g   t o   l o a d   " C : \ U s e r s \ A \ A p p D a t a \ R o a m i n g \ P y t h o n \ P y t h o n 3 1 1 \ s i t e - p a c k a g e s \ o n n x r u n t i m e \ c a p i \ o n n x r u n t i m e _ p r o v i d e r s _ c u d a . d l l "

 2 0 2 4 - 0 2 - 0 4   2 1 : 5 5 : 2 5 . 2 7 8 9 9 0 1   [ W : o n n x r u n t i m e : D e f a u l t ,   o n n x r u n t i m e _ p y b i n d _ s t a t e . c c : 6 4 0   o n n x r u n t i m e : : p y t h o n : : C r e a t e E x e c u t i o n P r o v i d e r I n s t a n c e ]   F a i l e d   t o   c r e a t e   C U D A E x e c u t i o n P r o v i d e r .   P l e a s e   r e f e r e n c e   h t t p s : / / o n n x r u n t i m e . a i / d o c s / e x e c u t i o n - p r o v i d e r s / C U D A - E x e c u t i o n P r o v i d e r . h t m l # r e q u i r e m e n t s   t o   e n s u r e   a l l   d e p e n d e n c i e s   a r e   m e t .

Is cuda required to run this?

EDIT:
After realizing the script went to mark_detector = MarkDetector("assets/face_landmarks.onnx") the 2nd time instead of failing at face_detector = FaceDetector("assets/face_detector.onnx") I redownloaded face_landmarks.onnx as well and now it works, albeit with the cuda console errors.

@IDEALIST-MAKER
Copy link

I am having this same issue, Windows with Python 3.11 environment. The first time, face_detector.onnx had an MD5 hash of a117d2bade61178baca5b6fa3163e72a After redownloading, it's 9d44dbc74e862957c4cf3b81294b9c94

However, I still receive:

 Traceback (most recent call last):
  File "c:\Users\A\Desktop\head-pose-estimation-master\main.py", line 123, in <module>
    run()
  File "c:\Users\A\Desktop\head-pose-estimation-master\main.py", line 49, in run
    mark_detector = MarkDetector("assets/face_landmarks.onnx")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\A\Desktop\head-pose-estimation-master\mark_detection.py", line 20, in __init__
    self.model = ort.InferenceSession(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\A\AppData\Roaming\Python\Python311\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
    self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "C:\Users\A\AppData\Roaming\Python\Python311\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 424, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from assets/face_landmarks.onnx failed:Protobuf parsing failed.

as the traceback, but the 2nd run my console printed:

2 0 2 4 - 0 2 - 0 4   2 1 : 5 5 : 2 5 . 2 5 8 6 1 7 9   [ E : o n n x r u n t i m e : D e f a u l t ,   p r o v i d e r _ b r i d g e _ o r t . c c : 1 3 5 1   o n n x r u n t i m e : : T r y G e t P r o v i d e r I n f o _ C U D A ]   D : \ a \ _ w o r k \ 1 \ s \ o n n x r u n t i m e \ c o r e \ s e s s i o n \ p r o v i d e r _ b r i d g e _ o r t . c c : 1 1 3 1   o n n x r u n t i m e : : P r o v i d e r L i b r a r y : : G e t   [ O N N X R u n t i m e E r r o r ]   :   1   :   F A I L   :   L o a d L i b r a r y   f a i l e d   w i t h   e r r o r   1 2 6   " "   w h e n   t r y i n g   t o   l o a d   " C : \ U s e r s \ A \ A p p D a t a \ R o a m i n g \ P y t h o n \ P y t h o n 3 1 1 \ s i t e - p a c k a g e s \ o n n x r u n t i m e \ c a p i \ o n n x r u n t i m e _ p r o v i d e r s _ c u d a . d l l "

 2 0 2 4 - 0 2 - 0 4   2 1 : 5 5 : 2 5 . 2 7 8 9 9 0 1   [ W : o n n x r u n t i m e : D e f a u l t ,   o n n x r u n t i m e _ p y b i n d _ s t a t e . c c : 6 4 0   o n n x r u n t i m e : : p y t h o n : : C r e a t e E x e c u t i o n P r o v i d e r I n s t a n c e ]   F a i l e d   t o   c r e a t e   C U D A E x e c u t i o n P r o v i d e r .   P l e a s e   r e f e r e n c e   h t t p s : / / o n n x r u n t i m e . a i / d o c s / e x e c u t i o n - p r o v i d e r s / C U D A - E x e c u t i o n P r o v i d e r . h t m l # r e q u i r e m e n t s   t o   e n s u r e   a l l   d e p e n d e n c i e s   a r e   m e t .

Is cuda required to run this?

EDIT: After realizing the script went to mark_detector = MarkDetector("assets/face_landmarks.onnx") the 2nd time instead of failing at face_detector = FaceDetector("assets/face_detector.onnx") I redownloaded face_landmarks.onnx as well and now it works, albeit with the cuda console errors.

Could you tell me where I can download the face_detector.onnx and face_loadmarks.onnx? I use command "git lfs clone",but it doesn't make it.

@yinguobing
Copy link
Owner

The onnx files are tracked by git lfs. Please fetch them with git lfs after cloning the repository

git lfs pull

If you see error message like this

batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.                                         
error: failed to fetch some objects from 'https://github.com/yinguobing/head-pose-estimation.git/info/lfs'

Unfortunately this is due to Github data usage quota, which provides 1 GB per month/repo. And yes, I'm also blocked by this quota limitation.

It seems we all have to wait for the next month's quota reset, then I can upload the onnx files to the release page that is free from the usage quota.

I'm sorry for this inconvenience.

@Sadat75
Copy link

Sadat75 commented Apr 9, 2024

Dear @yinguobing,

Thank you for your work. Currently, both the detection and the landmark onnx files seem to be corrupted. Is it possible to upload the onnx file for the facial landmark model in a drive this month?

Thank you.

@yinguobing
Copy link
Owner

I'm afraid that's not possible. There is no local backup of this repo since I used to believe GitHub is a safer place. Currently we all have to wait.

@Sadat75
Copy link

Sadat75 commented Apr 11, 2024

Dear @yinguobing,

Thank you for the response. I am looking forward to the availability of the facial landmark model soon.

@yinguobing
Copy link
Owner

Models are available in release page:
https://github.com/yinguobing/head-pose-estimation/releases/tag/v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants