vilari-mickopf / mmwave-gesture-recognition

Basic Gesture Recognition Using mmWave Sensor - TI AWR1642
MIT License
104 stars 21 forks source link

TensorFlow version issue #12

Closed ljxeggi closed 3 months ago

ljxeggi commented 3 months ago

Hello. I'm sorry to bother you. Thank you very much for disclosing "millimeter wave gesture recognition", which is of great help to me. In the process of running your code, it was able to run successfully in the previous time, but recently I encountered this problem, and I did not modify your code.

Looking for ports... Connecting to port 'COM4' Selecting baud rate 115200 Connecting to port 'COM3' Selecting baud rate 921600 Init done.

--- mmWave console --- Type 'help' for more information.

flash xwr16xx_mmw_demo.bin Ping mmWave...Done. Get version...Done. Version: b'03000a020000000000000000'

Formating flash...Done. Writing META_IMAGE1 [295236 bytes] Blocks: 100%|██████████| 1231/1231 [00:58<00:00, 21.00it/s] Done.

connect Disconnecting port COM4 Disconnecting port COM3

cli port: COM4 cli rate: 115200 data port: COM3 data rate: 921600 Connecting to port 'COM4' Selecting baud rate 115200 Connecting to port 'COM3' Selecting baud rate 921600

plot listen thread not started. Spawing listen. mmWave not configured. Configuring mmWave: Sending: sensorStop Received: Done

Sending: flushCfg Received: Done

Sending: dfeDataOutputMode 1 Received: Done

Sending: channelCfg 15 3 0 Received: Done

Sending: adcCfg 2 1 Received: Done

Sending: adcbufCfg -1 0 0 1 0 Received: Done

Sending: profileCfg 0 77 7 7 200 0 0 20 1 384 2000 0 0 30 Received: Done

Sending: chirpCfg 0 0 0 0 0 0 0 1 Received: Done

Sending: chirpCfg 1 1 0 0 0 0 0 2 Received: Done

Sending: frameCfg 0 1 16 0 100 1 0 Received: Done

Sending: lowPower 0 1 Received: Done

Sending: guiMonitor -1 1 0 0 0 0 0 Received: Done

Sending: cfarCfg -1 0 0 8 4 4 0 8534 Received: Done

Sending: cfarCfg -1 1 0 4 2 3 0 8534 Received: Done

Sending: peakGrouping -1 1 0 0 1 511 Received: Done

Sending: multiObjBeamForming -1 1 0.5 Received: Done

Sending: clutterRemoval -1 1 Received: Done

Sending: calibDcRangeSig -1 0 -5 8 256 Received: Done

Sending: extendedMaxVelocity -1 0 Received: Done

Sending: bpmCfg -1 0 0 1 Received: Done

Sending: lvdsStreamCfg -1 0 0 0 Received: Done

Sending: nearFieldCfg -1 0 0 0 Received: Done

Sending: compRangeBiasAndRxChanPhase 0.0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Received: Done

Sending: measureRangeBiasAndRxChanPhase 0 1.5 0.2 Received: Done

Sending: CQRxSatMonitor 0 3 19 127 0 Received: Done

Sending: CQSigImgMonitor 0 127 6 Received: Done

Sending: analogMonitor 1 1 Received: Done

Sending: sensorStart Received: Debug: Init Calibration Status = 0x7fe Done

=== Listening === Sync received!>>

predict Loading model...Exception in thread Thread-1: Traceback (most recent call last): File "D:\anaconda\envs\eggi9\lib\threading.py", line 980, in _bootstrap_inner self.run() File "D:\anaconda\envs\eggi9\lib\threading.py", line 917, in run self._target(*self._args, self._kwargs) File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave-console.py", line 832, in console_thread console.cmdloop() File "D:\anaconda\envs\eggi9\lib\cmd.py", line 138, in cmdloop stop = self.onecmd(line) File "D:\anaconda\envs\eggi9\lib\cmd.py", line 217, in onecmd return func(arg) File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave-console.py", line 251, in func_wrapper return func(self, *args, *kwargs) File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave-console.py", line 161, in wrapper return func(self, args, kwargs) File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave-console.py", line 670, in do_predict self.model.load() File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave_gesture\model.py", line 114, in load self.load_model(custom_objects) File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave_gesture\model.py", line 119, in load_model self.model = tf.keras.models.load_model(os.path.join(self.dir, 'model.h5'), File "D:\anaconda\envs\eggi9\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "D:\anaconda\envs\eggi9\lib\site-packages\keras\optimizers\optimizer_experimental\optimizer.py", line 115, in _process_kwargs raise TypeError( TypeError: weight_decay is not a valid argument, kwargs should be empty for optimizer_experimental.Optimizer.

Thank you for your time。

vilari-mickopf commented 3 months ago

Its most likely a tf/keras problem. They have changed some stuff in version 2.16, and a bunch of my previous code is breaking as well (in this case it is loading of models generated with older tf version). What version of python are you using and can you post the output of pip freeze? You might start by setting up conda to use python 3.11 and tf 2.15 (i am not 100% sure which tf version i have used in this project, but it might be 2.12).

ljxeggi commented 3 months ago

python 3.9 absl-py @ file:///C:/b/abs_14wchyjaia/croot/absl-py_1714140489450/work aiohttp @ file:///C:/b/abs_8860tt1424/croot/aiohttp_1715108828392/work aiosignal @ file:///tmp/build/80754af9/aiosignal_1637843061372/work astunparse==1.6.3 async-timeout @ file:///C:/b/abs_c8fgiuixkq/croot/async-timeout_1703097556097/work attrs @ file:///C:/b/abs_35n0jusce8/croot/attrs_1695717880170/work blinker @ file:///C:/b/abs_d9y2dm7cw2/croot/blinker_1696539752170/work Bottleneck @ file:///C:/b/abs_f05kqh7yvj/croot/bottleneck_1707864273291/work Brotli @ file:///C:/b/abs_3d36mno480/croot/brotli-split_1714483178642/work cachetools @ file:///C:/b/abs_792zbtc0ua/croot/cachetools_1713977157919/work certifi @ file:///C:/b/abs_55jxithrm3/croot/certifi_1717618077850/work/certifi cffi @ file:///C:/b/abs_78eb1_vq6z/croot/cffi_1714483206096/work charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work click @ file:///C:/b/abs_f9ihnt72pu/croot/click_1698129847492/work colorama @ file:///C:/b/abs_a9ozq0l032/croot/colorama_1672387194846/work contourpy @ file:///C:/b/abs_853rfy8zse/croot/contourpy_1700583617587/work cryptography @ file:///C:/b/abs_f4do8t8jfs/croot/cryptography_1694444424531/work cycler @ file:///tmp/build/80754af9/cycler_1637851556182/work flatbuffers @ file:///home/ktietz/cip/python-flatbuffers_1634039120618/work fonttools @ file:///C:/b/abs_f47gnfqnx0/croot/fonttools_1713551644747/work frozenlist @ file:///C:/b/abs_d8e__s1ys3/croot/frozenlist_1698702612014/work gast @ file:///Users/ktietz/demo/mc3/conda-bld/gast_1628588903283/work google-auth @ file:///C:/b/abs_059sl2dhu6/croot/google-auth_1715111206543/work google-auth-oauthlib @ file:///tmp/build/80754af9/google-auth-oauthlib_1617120569401/work google-pasta @ file:///Users/ktietz/demo/mc3/conda-bld/google-pasta_1630577991354/work grpcio @ file:///C:/b/abs_ccut8qek12/croot/grpc-suite_1681912611694/work h5py @ file:///C:/b/abs_c4ha_1xv14/croot/h5py_1715094776210/work idna @ file:///C:/b/abs_aad84bnnw5/croot/idna_1714398896795/work importlib-metadata @ file:///C:/b/abs_c1egths604/croot/importlib_metadata-suite_1704813568388/work importlib-resources @ file:///C:/b/abs_d0dmp77t95/croot/importlib_resources-suite_1704281892795/work joblib @ file:///C:/b/abs_f4b98l6lgk/croot/joblib_1718217224240/work keras @ file:///C:/Users/builder/adipietro/mc3/tf210/conda-bld/keras_1669760570649/work/keras-2.10.0-py2.py3-none-any.whl Keras-Preprocessing @ file:///tmp/build/80754af9/keras-preprocessing_1612283640596/work kiwisolver @ file:///C:/b/abs_88mdhvtahm/croot/kiwisolver_1672387921783/work Markdown @ file:///C:/b/abs_98lv_ucina/croot/markdown_1671541919225/work MarkupSafe @ file:///C:/b/absecfdqh67b/croot/markupsafe_1704206030535/work matplotlib @ file:///C:/b/abs_ddmsoovv14/croot/matplotlib-suite_1713336426307/work mkl-fft @ file:///C:/b/abs_19i1y8ykas/croot/mkl_fft_1695058226480/work mkl-random @ file:///C:/b/abs_edwkj1_o69/croot/mkl_random_1695059866750/work mkl-service==2.4.0 multidict @ file:///C:/b/abs_44ido987fv/croot/multidict_1701097803486/work numexpr @ file:///C:/b/abs_5fucrty5dc/croot/numexpr_1696515448831/work numpy @ file:///C:/b/abs_c1ywpu18ar/croot/numpy_and_numpy_base_1708638681471/work/dist/numpy-1.26.4-cp39-cp39-win_amd64.whl#sha256=f284633067fde4bb078a09085a1c9e99a3218c129f5312b7b3d76c9340442a25 oauthlib @ file:///C:/b/abs_44riqpe5gg/croot/oauthlib_1679489644705/work opt-einsum @ file:///tmp/build/80754af9/opt_einsum_1621500238896/work packaging @ file:///C:/b/abs_cc1h2xfosn/croot/packaging_1710807447479/work pandas @ file:///C:/b/abs_9aotnvvz16/croot/pandas_1718308978393/work/dist/pandas-2.2.2-cp39-cp39-win_amd64.whl#sha256=2f5f0df1e64fe2e35c0c1507e4a4ab7759dcd7e81c2cbb210f71e0abe3777165 pillow @ file:///C:/b/abs_95ls_qh4c2/croot/pillow_1714398870615/work ply==3.11 protobuf==3.20.3 pyasn1 @ file:///Users/ktietz/demo/mc3/conda-bld/pyasn1_1629708007385/work pyasn1-modules==0.2.8 pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work PyJWT @ file:///C:/b/abs_04qhgo75wz/croot/pyjwt_1715095119685/work pyOpenSSL @ file:///C:/b/abs_08f38zyck4/croot/pyopenssl_1690225407403/work pyparsing @ file:///C:/Users/BUILDE~1/AppData/Local/Temp/abs_7f_7lba6rl/croots/recipe/pyparsing_1661452540662/work PyQt5==5.15.10 PyQt5-sip @ file:///C:/b/abs_c0pi2mimq3/croot/pyqt-split_1698769125270/work/pyqt_sip pyreadline==2.1 pyserial==3.5 PySocks @ file:///C:/ci/pysocks_1605307512533/work python-dateutil @ file:///C:/b/abs_3au_koqnbs/croot/python-dateutil_1716495777160/work pytz @ file:///C:/b/abs_6ap4tsz1ox/croot/pytz_1713974360290/work requests @ file:///C:/b/abs_9c5n24p1y7/croot/requests_1716902867639/work requests-oauthlib==1.3.0 rsa @ file:///tmp/build/80754af9/rsa_1614366226499/work scikit-learn @ file:///C:/b/abs_d6_krvz8aa/croot/scikit-learn_1714164798159/work scipy @ file:///C:/b/abs_efv75hqhju/croot/scipy_1717521501389/work/dist/scipy-1.13.1-cp39-cp39-win_amd64.whl#sha256=b007813de746b130f0c7e6d81a850a9a511af7ac66d8f6b7dbad791a97eae977 seaborn @ file:///C:/b/abs_ca2mi1rgmn/croot/seaborn_1718303534355/work sip @ file:///C:/b/abs_edevan3fce/croot/sip_1698675983372/work six @ file:///tmp/build/80754af9/six_1644875935023/work tensorboard @ file:///C:/Users/builder/adipietro/mc3/tf210/conda-bld/tensorboard_1669760968711/work/tensorboard-2.10.0-py3-none-any.whl tensorboard-data-server @ file:///C:/b/abs_2fhvpo862s/croot/tensorboard-data-server_1670853600144/work/tensorboard_data_server-0.6.1-py3-none-any.whl tensorboard-plugin-wit @ file:///C:/tf/b/tensorboard-plugin-wit_1660162132996/work/tensorboard_plugin_wit-1.8.1-py3-none-any.whl tensorflow==2.10.0 tensorflow-estimator @ file:///C:/Users/builder/adipietro/mc3/tf210/conda-bld/tensorflow-estimator_1669761460695/work/tensorflow_estimator-2.10.0-py2.py3-none-any.whl termcolor @ file:///C:/b/abs_16qe7jhw7n/croot/termcolor_1668084642458/work threadpoolctl @ file:///Users/ktietz/demo/mc3/conda-bld/threadpoolctl_1629802263681/work tomli @ file:///C:/Windows/TEMP/abs_ac109f85-a7b3-4b4d-bcfd-52622eceddf0hy332ojo/croots/recipe/tomli_1657175513137/work tornado @ file:///C:/b/abs_7bua0304mj/croot/tornado_1718740122405/work tqdm @ file:///C:/b/abs_a7h7n45ccq/croot/tqdm_1716395987133/work typing_extensions @ file:///C:/b/abs_0as9mdbkfl/croot/typing_extensions_1715268906610/work tzdata @ file:///croot/python-tzdata_1690578112552/work unicodedata2 @ file:///C:/b/abs_b6apldlg7y/croot/unicodedata2_1713212998255/work urllib3 @ file:///C:/b/abs_8e4z8_gh1l/croot/urllib3_1715636317140/work Werkzeug @ file:///C:/b/abs_8bittcw9jr/croot/werkzeug_1716533366070/work win-inet-pton @ file:///C:/ci/win_inet_pton_1605306162074/work wrapt @ file:///C:/Windows/Temp/abs_7c3dd407-1390-477a-b542-fd15df6a24085_diwiza/croots/recipe/wrapt_1657814452175/work yarl @ file:///C:/b/abs_8bxwdyhjvp/croot/yarl_1701105248152/work zipp @ file:///C:/b/abs_b0beoc27oa/croot/zipp_1704206963359/work

vilari-mickopf commented 3 months ago

Yup, Ive installed conda env with python 3.9 and tf 2.10 and got the same issue. After upgrading to tf 2.12, the issue is resolved.

conda install -c conda-forge tensorflow-gpu=2.12 -y

If you are, for some reason, tied to tf 2.10, you could run the training process (the data used is available as well), and it should generate models that are compatible with 2.10.

ljxeggi commented 3 months ago

I have downloaded tensorflow2.12, but the GPU version cannot be downloaded, so I only downloaded tensorflow2.12, but the following problems will occur。

Traceback (most recent call last): File "D:\mmwave-gesture-recognition-master (1)\mmwave-gesture-recognition-master\mmwave_gesture\model.py", line 16, in from tensorflow.keras import layers, callbacks # type: ignore ImportError: cannot import name 'callbacks' from 'tensorflow.keras' (unknown location) This path does miss the callbacks file

vilari-mickopf commented 3 months ago

My guess is that keras has stayed on older version. Try updating it to 2.12 as well, that should solve the issue. Having gpu or non gpu tf shoudn't make any difference.

Alternatively, you can create new env, and install tf 2.12 first:

conda create --name mmwave-gesture python=3.9 -y
conda activate mmwave-gesture
conda install pip -y
pip install tensorflow==2.12
pip install -e .

That should pull proper versions of keras (because nothing is cached on fresh env) and everything else needed for tf to work.

ljxeggi commented 3 months ago

Ok, thanks. I'll try

vilari-mickopf commented 3 months ago

Ok, i've done some checks and models are generated using tf 2.15, however, majority of models (all except resnets, will load with tf >= 2.12 and <= 2.15. Traning process should work just fine on all version except 2.16 (there are some bugs when handling nested models, that have been fixed upstream, but i am not sure when those changes will officially make it into the release. I will set tf to 2.15 in setup.py