imx93 for eIQ Demos

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx93 for eIQ Demos

Jump to solution
123 Views
charleshuang
Senior Contributor II

Hi NXP,
I am using the i.MX 93 11x11 with kernel 6.1.36 and running eIQ Demos, but currently, it fails to execute.
Referencing (9.1 TensorFlow Lite Demos for i.MX 93),
the following error occurs.
root@imx93-11x11-lpddr4x-evk:/usr/bin/eiq-examples-git# python3 download_models.py
Download file from https://drive.google.com/uc?export=download&&id=1yjWyXsac5CbGWYuHWYhhnr_9cAwg3uNI

Traceback (most recent call last):
File "/usr/lib/python3.11/tarfile.py", line 1705, in gzopen
t = cls.taropen(name, mode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 1682, in taropen
return cls(name, mode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 1542, in __init__
self.firstmember = self.next()
^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 2379, in next
raise e
File "/usr/lib/python3.11/tarfile.py", line 2352, in next
tarinfo = self.tarinfo.fromtarfile(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 1122, in fromtarfile
buf = tarfile.fileobj.read(BLOCKSIZE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/gzip.py", line 301, in read
return self._buffer.read(size)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/gzip.py", line 499, in read
if not self._read_gzip_header():
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/gzip.py", line 468, in _read_gzip_header
last_mtime = _read_gzip_header(self._fp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/gzip.py", line 428, in _read_gzip_header
raise BadGzipFile('Not a gzipped file (%r)' % magic)
gzip.BadGzipFile: Not a gzipped file (b'<h')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/bin/eiq-examples-git/download_models.py", line 98, in <module>
download_all_models(model_dir, vela_dir)
File "/usr/bin/eiq-examples-git/download_models.py", line 43, in download_all_models
decompress(path, model_dir)
File "/usr/bin/eiq-examples-git/download_models.py", line 28, in decompress
tar = tarfile.open(path, "r:gz")
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 1652, in open
return func(name, filemode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/tarfile.py", line 1709, in gzopen
raise ReadError("not a gzip file") from e
tarfile.ReadError: not a gzip file

0 Kudos
1 Solution
81 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @charleshuang!

Thank you for contacting NXP Support!

As you mention some links within the script are broken. I will report it to solve it as soon as possible. In the meantime, let me guide you through downloading the models so you can run the examples in section 9.1.

9.1.1 Image classification demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://www.kaggle.com/models/tensorflow/mobilenet-v1/frameworks/TfLite/variations/1-0-224-quantized/versions/1/download/QcXckPqvAHPeOIWzfl1C%2Fversions%2FZ7a7ay8NCjo6fj7zV4Wy%2Ffiles%2F1.tflite
mv QcXckPqvAHPeOIWzfl1C%2Fversions%2FZ7a7ay8NCjo6fj7zV4Wy%2Ffiles%2F1.tflite mobilenet_v1_1.0_224_quant.tflite
# Run example
cd ../image_classification/
python3 label_image.py -i grace_hopper.bmp -l labels.txt

 

9.1.2 SSD object detection demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2.tflite
mv 2.tflite ssd_mobilenet_v1_quant.tflite
# Run example
cd ../object_detection/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

9.1.3 Hand gesture detection demo

 

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/033_Hand_Detection_and_Tracking/resources.tar.gz
# Extract models
tar -xvzf resources.tar.gz 033_Hand_Detection_and_Tracking/03_integer_quantization
tar -xvzf 033_Hand_Detection_and_Tracking/03_integer_quantization/resources.tar.gz
# Clean directory
rm -r 033_Hand_Detection_and_Tracking
rm hand_landmark_256_integer_quant.tflite
rm resources.tar.gz
# Run example
cd ../gesture_detection/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

9.1.4 Face recognition demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://raw.githubusercontent.com/imuncle/yoloface-50k/main/tflite/yoloface_int8.tflite
wget https://raw.githubusercontent.com/shubham0204/FaceRecognition_With_FaceNet_Android/master/app/src/main/assets/facenet_512_int_quantized.tflite
# Run example
cd ../face_recognition/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

Note that in some examples I am using the --delegate argument. This is to improve the performance of the examples. I'm also assuming you have a camera web connected to the board. Anyway, you just can simply download the models and follow the instructions in the Machine Learning User's Guide. Please let me know if any problem occurs.

Best Regards!

Chavira

View solution in original post

0 Kudos
1 Reply
82 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @charleshuang!

Thank you for contacting NXP Support!

As you mention some links within the script are broken. I will report it to solve it as soon as possible. In the meantime, let me guide you through downloading the models so you can run the examples in section 9.1.

9.1.1 Image classification demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://www.kaggle.com/models/tensorflow/mobilenet-v1/frameworks/TfLite/variations/1-0-224-quantized/versions/1/download/QcXckPqvAHPeOIWzfl1C%2Fversions%2FZ7a7ay8NCjo6fj7zV4Wy%2Ffiles%2F1.tflite
mv QcXckPqvAHPeOIWzfl1C%2Fversions%2FZ7a7ay8NCjo6fj7zV4Wy%2Ffiles%2F1.tflite mobilenet_v1_1.0_224_quant.tflite
# Run example
cd ../image_classification/
python3 label_image.py -i grace_hopper.bmp -l labels.txt

 

9.1.2 SSD object detection demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2.tflite
mv 2.tflite ssd_mobilenet_v1_quant.tflite
# Run example
cd ../object_detection/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

9.1.3 Hand gesture detection demo

 

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/033_Hand_Detection_and_Tracking/resources.tar.gz
# Extract models
tar -xvzf resources.tar.gz 033_Hand_Detection_and_Tracking/03_integer_quantization
tar -xvzf 033_Hand_Detection_and_Tracking/03_integer_quantization/resources.tar.gz
# Clean directory
rm -r 033_Hand_Detection_and_Tracking
rm hand_landmark_256_integer_quant.tflite
rm resources.tar.gz
# Run example
cd ../gesture_detection/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

9.1.4 Face recognition demo

cd /usr/bin/eiq-examples-git/models/
# Get models
wget https://raw.githubusercontent.com/imuncle/yoloface-50k/main/tflite/yoloface_int8.tflite
wget https://raw.githubusercontent.com/shubham0204/FaceRecognition_With_FaceNet_Android/master/app/src/main/assets/facenet_512_int_quantized.tflite
# Run example
cd ../face_recognition/
python3 main.py --delegate /usr/lib/libethosu_delegate.so

 

Note that in some examples I am using the --delegate argument. This is to improve the performance of the examples. I'm also assuming you have a camera web connected to the board. Anyway, you just can simply download the models and follow the instructions in the Machine Learning User's Guide. Please let me know if any problem occurs.

Best Regards!

Chavira

0 Kudos