Skip to content

Greengrass TensorFlowLiteImageClassification test fail

0

Hi AWS team,

I am currently running the Greengrass qualification test. But the TensorFlowLiteImageClassification test item has consistently failed to pass. My OS is Debian on an aarch64 architecture.

Test log:

A module that was compiled using NumPy 1.x cannot be run in. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.224Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. NumPy 2.0.2 as it may crash. To support both 1.x and 2.x. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.225Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. versions of NumPy, modules must be compiled with NumPy 2.0.. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.225Z [INFO] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stdout. Exception occured during the allocation of tensors: <built-in method CreateWrapperFromFile of PyCapsule object at 0x7f8e531390> returned a result with an error set. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.225Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.226Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.227Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. If you are a user of the module, the easiest solution will be to. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.228Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. downgrade to 'numpy<2' or try to upgrade the affected module.. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}
2024-10-29T10:02:27.229Z [WARN] (Copier) aws.greengrass.TensorFlowLiteImageClassification: stderr. We expect that some modules will need time to support NumPy 2.. {scriptName=services.aws.greengrass.TensorFlowLiteImageClassification.lifecycle.run.script, serviceName=aws.greengrass.TensorFlowLiteImageClassification, currentState=RUNNING}

It seem that Numpy version should < 2. But my Numpy version already <2. 在此輸入圖片描述

3 Answers
1

The issue you're experiencing with the TensorFlowLiteImageClassification test failing appears to be related to a compatibility problem between the TensorFlow Lite component and the version of NumPy installed on your system.

Even though you mentioned that your NumPy version is already less than 2, the error message suggests that there might be a mismatch between the version of NumPy used to compile the TensorFlow Lite module and the version currently installed on your system.

To resolve this issue, you can try the following steps:

  1. Verify the exact version of NumPy installed on your system by running pip3 list | grep numpy or python3 -c "import numpy; print(numpy.__version__)".

  2. If the NumPy version is 2.x, try downgrading it to a 1.x version, preferably 1.22.4 or later. You can do this by running:

    pip3 install --upgrade numpy==1.22.4
    
  3. If you're using a Raspberry Pi device running Raspberry Pi OS Bullseye, make sure you have NumPy 1.22.4 or later installed, as earlier versions that come with the OS may not be compatible.

  4. Ensure that all the required dependencies for the TensorFlow Lite components are installed, especially for Armv7l devices like Raspberry Pi. You may need to run:

    sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
    
  5. If you're using a Raspberry Pi with Raspberry Pi OS Bullseye, make sure the legacy camera stack is enabled, as the new camera stack is not compatible with this component.

  6. After making these changes, try redeploying the TensorFlow Lite components and running the qualification test again.

If the issue persists, you may need to check if there are any compatibility issues between the TensorFlow Lite components and your specific Debian aarch64 setup. Consider reaching out to AWS support for further assistance, as they may have more specific guidance for your particular hardware and software configuration.
Sources
TensorFlow Lite runtime - AWS IoT Greengrass
Configure your device to run IDT tests - AWS IoT Greengrass
TensorFlow Lite image classification model store - AWS IoT Greengrass

answered 2 years ago
AWS
EXPERT
reviewed 2 years ago
  • I think this answer is right. Your log suggests that you have numpy 2.0.2 installed, but the component requires 1.x.

0

Hi Greg_B

But my PreInstalled is set to 'no'. From the logs, it seems that IDT installed numpy by itself. The version of numpy installed on my DUT is also below 2.

2024-10-29T10:00:08.982Z [WARN] (Copier) variant.TensorFlowLite: stderr. + source ../variant.TensorFlowLite/greengrass_ml/greengrass_ml_tflite_venv/bin/activate. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:08.997Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ deactivate nondestructive. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:08.999Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.001Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n /usr/bin/bash -o -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.002Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ hash -r. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.003Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.004Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ unset VIRTUAL_ENV. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.005Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' '!' nondestructive = nondestructive ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.006Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ VIRTUAL_ENV=/greengrass/v2/idt-055f425063677087b33/work/variant.TensorFlowLite/greengrass_ml/greengrass_ml_tflite_venv. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.008Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ export VIRTUAL_ENV. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.009Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ _OLD_VIRTUAL_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.010Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ PATH=/greengrass/v2/idt-055f425063677087b33/work/variant.TensorFlowLite/greengrass_ml/greengrass_ml_tflite_venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.011Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ export PATH. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.012Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.013Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -z '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.014Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ _OLD_VIRTUAL_PS1=. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.015Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ PS1='(greengrass_ml_tflite_venv) '. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.016Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ export PS1. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.017Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ '[' -n /usr/bin/bash -o -n '' ']'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.018Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ hash -r. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.019Z [WARN] (Copier) variant.TensorFlowLite: stderr. + cd ../variant.TensorFlowLite/greengrass_ml/greengrass_ml_tflite_venv. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.020Z [WARN] (Copier) variant.TensorFlowLite: stderr. + install_python3_libraries. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.021Z [WARN] (Copier) variant.TensorFlowLite: stderr. ++ python3 -c 'try:. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.023Z [WARN] (Copier) variant.TensorFlowLite: stderr. import cv2. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.024Z [WARN] (Copier) variant.TensorFlowLite: stderr. print(cv2.__version__). {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.025Z [WARN] (Copier) variant.TensorFlowLite: stderr. except Exception as e:. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.026Z [WARN] (Copier) variant.TensorFlowLite: stderr. print(e)'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.094Z [WARN] (Copier) variant.TensorFlowLite: stderr. + opencv='No module named '\''cv2'\'''. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.094Z [INFO] (Copier) variant.TensorFlowLite: stdout. Installing opencv.... {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.096Z [WARN] (Copier) variant.TensorFlowLite: stderr. + [[ No module named 'cv2' == *\N\o\ \m\o\d\u\l\e\ \n\a\m\e\d\ \'\c\v\2\'* ]]. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.097Z [WARN] (Copier) variant.TensorFlowLite: stderr. + echo 'Installing opencv...'. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:09.098Z [WARN] (Copier) variant.TensorFlowLite: stderr. + pip3 install opencv-python. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:27.910Z [INFO] (Copier) variant.TensorFlowLite: stdout. Collecting opencv-python. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:28.328Z [INFO] (Copier) variant.TensorFlowLite: stdout. Using cached opencv_python-4.10.0.84-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (41.7 MB). {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:36.166Z [INFO] (Copier) variant.TensorFlowLite: stdout. Collecting numpy>=1.17.3. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:36.322Z [INFO] (Copier) variant.TensorFlowLite: stdout. Using cached numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB). {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:37.239Z [INFO] (Copier) variant.TensorFlowLite: stdout. Installing collected packages: numpy, opencv-python. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
2024-10-29T10:00:58.396Z [INFO] (Copier) variant.TensorFlowLite: stdout. Successfully installed numpy-2.0.2 opencv-python-4.10.0.84. {scriptName=services.variant.TensorFlowLite.lifecycle.install.script, serviceName=variant.TensorFlowLite, currentState=NEW}
answered 2 years ago
0

The latest IDT removes the ML aspects of the testing.

https://docs.aws.amazon.com/greengrass/v2/developerguide/dev-test-versions.html

Try using the latest versions and let us know if there is still a problem.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.