anish9 / Face-Parsing-Lite

Segment 18 classes of face(Nose,eyes, hair, skin, hat etc...) pixel wise with high accuracy,
3 stars 0 forks source link

ERROR - ValueError: Layer 'conv2d_1' expected 2 variables, but received 0 variables during loading. Expected: ['inv_res_block/conv2d_1/kernel:0', 'inv_res_block/conv2d_1/bias:0'] #1

Open affds11 opened 1 month ago

affds11 commented 1 month ago

Hi I'm getting this error, do you have any idea what could be wrong?

Line 16# model_base.load_weights("faceparserV1.weights.h5")

Traceback (most recent call last):
  File "I:\Face-Parsing-Lite\Face-Parsing-Lite\test.py", line 16, in <module>
    model_base.load_weights("faceparserV1.weights.h5" )
  File "I:\Face-Parsing-Lite\Miniconda\envs\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "I:\Face-Parsing-Lite\Miniconda\envs\lib\site-packages\keras\src\engine\base_layer.py", line 3531, in load_own_variables
    raise ValueError(
ValueError: Layer 'conv2d_1' expected 2 variables, but received 0 variables during loading. Expected: ['inv_res_block/conv2d_1/kernel:0', 'inv_res_block/conv2d_1/bias:0']

Thank you for great work. affds

Model summary:

Model: "parser"
__________________________________________________________________________________________________
 Layer (type)                Output Shape                 Param #   Connected to
==================================================================================================
 input_1 (InputLayer)        [(None, None, None, 3)]      0         []

 inv_res_block (inv_res_blo  (None, None, None, 16)       688       ['input_1[0][0]']
 ck)

 inv_res_block_1 (inv_res_b  (None, None, None, 32)       2304      ['inv_res_block[0][0]']
 lock)

 inv_res_block_2 (inv_res_b  (None, None, None, 64)       7680      ['inv_res_block_1[0][0]']
 lock)

 inv_res_block_3 (inv_res_b  (None, None, None, 96)       17664     ['inv_res_block_2[0][0]']
 lock)

 inv_res_block_4 (inv_res_b  (None, None, None, 96)       20736     ['inv_res_block_3[0][0]']
 lock)

 inv_res_block_5 (inv_res_b  (None, None, None, 128)      31744     ['inv_res_block_4[0][0]']
 lock)

 inv_res_block_6 (inv_res_b  (None, None, None, 128)      35840     ['inv_res_block_5[0][0]']
 lock)

 inv_res_block_7 (inv_res_b  (None, None, None, 192)      66048     ['inv_res_block_6[0][0]']
 lock)

 depthwise_conv2d_8 (Depthw  (None, None, None, 192)      1920      ['inv_res_block_7[0][0]']
 iseConv2D)

 batch_normalization_24 (Ba  (None, None, None, 192)      768       ['depthwise_conv2d_8[0][0]']
 tchNormalization)

 upscale_block (upscale_blo  (None, None, None, 128)      516864    ['batch_normalization_24[0][0]
 ck)                                                                ',
                                                                     'inv_res_block_6[0][0]']

 upscale_block_1 (upscale_b  (None, None, None, 64)       240032    ['upscale_block[0][0]',
 lock)                                                               'inv_res_block_5[0][0]']

 upscale_block_2 (upscale_b  (None, None, None, 64)       129408    ['upscale_block_1[0][0]',
 lock)                                                               'inv_res_block_4[0][0]']

 upscale_block_3 (upscale_b  (None, None, None, 64)       74080     ['upscale_block_2[0][0]',
 lock)                                                               'inv_res_block_2[0][0]']

 upscale_block_4 (upscale_b  (None, None, None, 32)       37056     ['upscale_block_3[0][0]',
 lock)                                                               'inv_res_block_1[0][0]']

 upscale_block_5 (upscale_b  (None, None, None, 32)       23232     ['upscale_block_4[0][0]',
 lock)                                                               'inv_res_block[0][0]']

 conv2d_22 (Conv2D)          (None, None, None, 19)       627       ['upscale_block_5[0][0]']

 activation_36 (Activation)  (None, None, None, 19)       0         ['conv2d_22[0][0]']

==================================================================================================
Total params: 1206691 (4.60 MB)
Trainable params: 1201027 (4.58 MB)
Non-trainable params: 5664 (22.12 KB)
anish9 commented 1 month ago

@affds11 what version of tensorflow is used here?

affds11 commented 1 month ago

@affds11 what version of tensorflow is used here?

tensorflow 2.15.0 Keras same

Hi :) I'm on Windows 11 / RTX 3090 / miniconda python 3.10 (i tried 3.7,3.8 still same error): All packages:

Package                      Version
---------------------------- ---------------
absl-py                      2.1.0
anyio                        4.3.0
argon2-cffi                  23.1.0
argon2-cffi-bindings         21.2.0
arrow                        1.3.0
asttokens                    2.4.1
astunparse                   1.6.3
async-lru                    2.0.4
attrs                        23.2.0
Babel                        2.14.0
beautifulsoup4               4.12.3
bleach                       6.1.0
build                        1.2.1
cachetools                   5.3.3
certifi                      2024.2.2
cffi                         1.16.0
chardet                      5.2.0
charset-normalizer           3.3.2
click                        8.1.7
colorama                     0.4.6
comm                         0.2.1
contourpy                    1.2.0
cramjam                      2.8.2
cycler                       0.12.1
debugpy                      1.8.1
decorator                    5.1.1
defusedxml                   0.7.1
distinctipy                  1.3.4
dm-tree                      0.1.8
et-xmlfile                   1.1.0
exceptiongroup               1.2.0
executing                    2.0.1
ezdxf                        1.2.0
fastjsonschema               2.19.1
fastparquet                  2024.2.0
filelock                     3.13.1
flatbuffers                  24.3.6
fonttools                    4.49.0
fqdn                         1.5.1
fsspec                       2024.2.0
gast                         0.5.4
google-auth                  2.28.1
google-auth-oauthlib         1.2.0
google-pasta                 0.2.0
grpcio                       1.62.0
h11                          0.14.0
h5py                         3.10.0
httpcore                     1.0.4
httpx                        0.27.0
huggingface-hub              0.21.4
idna                         3.6
ipykernel                    6.29.3
ipython                      8.22.2
isoduration                  20.11.0
jedi                         0.19.1
Jinja2                       3.1.3
joblib                       1.4.2
json5                        0.9.22
jsonpointer                  2.4
jsonschema                   4.21.1
jsonschema-specifications    2023.12.1
jupyter_client               8.6.0
jupyter_core                 5.7.1
jupyter-events               0.9.0
jupyter-lsp                  2.2.4
jupyter_server               2.13.0
jupyter_server_terminals     0.5.2
jupyterlab                   4.1.4
jupyterlab_pygments          0.3.0
jupyterlab_server            2.25.3
kagglehub                    0.2.0
keras                        2.15.0
keras-core                   0.1.7
keras-nlp                    0.14.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.5
libclang                     16.0.6
Markdown                     3.5.2
markdown-it-py               3.0.0
MarkupSafe                   2.1.5
matplotlib                   3.8.3
matplotlib-inline            0.1.6
mdurl                        0.1.2
mistune                      3.0.2
ml-dtypes                    0.2.0
namex                        0.0.7
nbclient                     0.9.0
nbconvert                    7.16.2
nbformat                     5.9.2
nest-asyncio                 1.6.0
notebook_shim                0.2.4
numpy                        1.26.4
oauthlib                     3.2.2
opencv-python                4.9.0.80
openpyxl                     3.1.2
opt-einsum                   3.3.0
overrides                    7.7.0
packaging                    23.2
pandas                       2.2.1
pandocfilters                1.5.1
parso                        0.8.3
pexpect                      4.9.0
pillow                       10.2.0
pip                          24.1.2
pip-tools                    7.4.1
platformdirs                 4.2.0
prometheus_client            0.20.0
prompt-toolkit               3.0.43
protobuf                     4.25.3
psutil                       5.9.8
ptyprocess                   0.7.0
pure-eval                    0.2.2
pyarrow                      15.0.0
pyasn1                       0.5.1
pyasn1-modules               0.3.0
pycparser                    2.21
Pygments                     2.17.2
PyMuPDF                      1.24.5
PyMuPDFb                     1.24.3
pyparsing                    3.1.2
pyproject_hooks              1.1.0
python-dateutil              2.9.0.post0
python-json-logger           2.0.7
pytz                         2024.1
pywin32                      306
pywinpty                     2.0.13
PyYAML                       6.0.1
pyzmq                        25.1.2
referencing                  0.33.0
regex                        2023.12.25
reportlab                    4.1.0
requests                     2.31.0
requests-oauthlib            1.3.1
rfc3339-validator            0.1.4
rfc3986-validator            0.1.1
rich                         13.7.1
rpds-py                      0.18.0
rsa                          4.9
safetensors                  0.4.2
scikit-learn                 1.5.0
scipy                        1.13.1
Send2Trash                   1.8.2
setuptools                   68.2.2
six                          1.16.0
sniffio                      1.3.1
soupsieve                    2.5
stack-data                   0.6.3
tensorboard                  2.15.2
tensorboard-data-server      0.7.2
tensorboard-plugin-wit       1.8.1
**tensorflow                   2.15.0**
tensorflow-estimator         2.15.0
tensorflow-hub               0.16.1
tensorflow-intel             2.15.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor                    2.4.0
terminado                    0.18.0
**tf-keras                     2.15.0**
threadpoolctl                3.5.0
tiktoken                     0.6.0
tinycss2                     1.2.1
tokenizers                   0.15.2
tomli                        2.0.1
tornado                      6.4
tqdm                         4.66.2
traitlets                    5.14.1
transformers                 4.38.2
types-python-dateutil        2.8.19.20240106
typing_extensions            4.10.0
tzdata                       2024.1
uri-template                 1.3.0
urllib3                      2.2.1
wcwidth                      0.2.13
webcolors                    1.13
webencodings                 0.5.1
websocket-client             1.7.0
Werkzeug                     3.0.1
wheel                        0.41.2
wincertstore                 0.2
wrapt                        1.14.1