tensorflow / models

Models and examples built with TensorFlow
Other
76.97k stars 45.79k forks source link

Object Detection API installation fails on a Raspberry Pi 4 #9711

Open hankster opened 3 years ago

hankster commented 3 years ago

I'm trying to install the Object Detection API using a Raspberry Pi 4 with all the latest updates (Raspbian Linux raspberrypi-4a 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l GNU/Linux).

Following the guide exactly as written. Starts out ok and then downloads maybe 35 versions of "scipy" and multiple versions of other packages. Ran it all day and it never completed.

root@raspberrypi-4a:/home/pi# rm -fr models root@raspberrypi-4a:/home/pi# git clone https://github.com/tensorflow/models.git Cloning into 'models'... remote: Enumerating objects: 37, done. remote: Counting objects: 100% (37/37), done. remote: Compressing objects: 100% (37/37), done. remote: Total 51426 (delta 12), reused 25 (delta 0), pack-reused 51389 Receiving objects: 100% (51426/51426), 568.89 MiB | 3.82 MiB/s, done. Resolving deltas: 100% (35093/35093), done. Checking out files: 100% (2227/2227), done. root@raspberrypi-4a:/home/pi# cd models/research root@raspberrypi-4a:/home/pi/models/research# protoc object_detection/protos/*.proto --python_out=. root@raspberrypi-4a:/home/pi/models/research# cp object_detection/packages/tf2/setup.py . root@raspberrypi-4a:/home/pi/models/research# python3 -m pip install --use-feature=2020-resolver . WARNING: --use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0. Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Processing /home/pi/models/research Collecting avro-python3 Using cached https://www.piwheels.org/simple/avro-python3/avro_python3-1.10.1-py3-none-any.whl (44 kB) Collecting apache-beam Using cached https://www.piwheels.org/simple/apache-beam/apache_beam-2.27.0-cp37-cp37m-linux_armv7l.whl (8.7 MB) Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from object-detection==0.1) (5.4.1) Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from object-detection==0.1) (4.3.2) Requirement already satisfied: matplotlib in /usr/lib/python3/dist-packages (from object-detection==0.1) (3.0.2) Collecting Cython Using cached https://www.piwheels.org/simple/cython/Cython-0.29.21-cp37-cp37m-linux_armv7l.whl (4.7 MB) Collecting contextlib2 Using cached https://www.piwheels.org/simple/contextlib2/contextlib2-0.6.0.post1-py2.py3-none-any.whl (9.8 kB) Collecting tf-slim Using cached tf_slim-1.1.0-py2.py3-none-any.whl (352 kB) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from object-detection==0.1) (1.15.0) Collecting pycocotools Using cached https://www.piwheels.org/simple/pycocotools/pycocotools-2.0.2-cp37-cp37m-linux_armv7l.whl (304 kB) Collecting lvis Using cached https://www.piwheels.org/simple/lvis/lvis-0.5.6-py3-none-any.whl (14 kB) Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from object-detection==0.1) (1.6.0) Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from object-detection==0.1) (1.1.0) Collecting tf-models-official Using cached https://www.piwheels.org/simple/tf-models-official/tf_models_official-2.4.0-py2.py3-none-any.whl (1.1 MB) Collecting pyarrow<3.0.0,>=0.15.1 Using cached pyarrow-2.0.0.tar.gz (58.9 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Requirement already satisfied: future<1.0.0,>=0.18.2 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (0.18.2) Collecting dill<0.3.2,>=0.3.1.1 Using cached https://www.piwheels.org/simple/dill/dill-0.3.1.1-py3-none-any.whl (78 kB) Collecting fastavro<2,>=0.21.4 Downloading https://www.piwheels.org/simple/fastavro/fastavro-1.3.1-cp37-cp37m-linux_armv7l.whl (1.8 MB) |████████████████████████████████| 1.8 MB 794 kB/s Collecting python-dateutil<3,>=2.8.0 Using cached https://www.piwheels.org/simple/python-dateutil/python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) Collecting pydot<2,>=1.2.0 Using cached https://www.piwheels.org/simple/pydot/pydot-1.4.1-py2.py3-none-any.whl (19 kB) Collecting crcmod<2.0,>=1.7 Using cached https://www.piwheels.org/simple/crcmod/crcmod-1.7-cp37-cp37m-linux_armv7l.whl (36 kB) Collecting requests<3.0.0,>=2.24.0 Using cached https://www.piwheels.org/simple/requests/requests-2.25.1-py2.py3-none-any.whl (61 kB) Collecting oauth2client<5,>=2.0.1 Using cached https://www.piwheels.org/simple/oauth2client/oauth2client-4.1.3-py2.py3-none-any.whl (98 kB) Collecting httplib2<0.18.0,>=0.8 Using cached https://www.piwheels.org/simple/httplib2/httplib2-0.17.4-py3-none-any.whl (95 kB) Requirement already satisfied: protobuf<4,>=3.12.2 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (3.12.4) Collecting hdfs<3.0.0,>=2.1.0 Using cached https://www.piwheels.org/simple/hdfs/hdfs-2.5.8-py3-none-any.whl (34 kB) Collecting avro-python3 Using cached https://www.piwheels.org/simple/avro-python3/avro_python3-1.9.2.1-py3-none-any.whl (44 kB) Requirement already satisfied: typing-extensions<3.8.0,>=3.7.0 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (3.7.4.3) Collecting pymongo<4.0.0,>=3.8.0 Using cached https://www.piwheels.org/simple/pymongo/pymongo-3.11.3-cp37-cp37m-linux_armv7l.whl (495 kB) Requirement already satisfied: grpcio<2,>=1.29.0 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (1.32.0) Requirement already satisfied: numpy<2,>=1.14.3 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (1.19.5) Collecting mock<3.0.0,>=1.0.1 Using cached https://www.piwheels.org/simple/mock/mock-2.0.0-py2.py3-none-any.whl (56 kB) Requirement already satisfied: pytz>=2018.3 in /usr/local/lib/python3.7/dist-packages (from apache-beam->object-detection==0.1) (2020.1) Collecting docopt Using cached https://www.piwheels.org/simple/docopt/docopt-0.6.2-py2.py3-none-any.whl (13 kB) Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python3.7/dist-packages (from mock<3.0.0,>=1.0.1->apache-beam->object-detection==0.1) (5.4.4) Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from oauth2client<5,>=2.0.1->apache-beam->object-detection==0.1) (4.6) Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python3.7/dist-packages (from oauth2client<5,>=2.0.1->apache-beam->object-detection==0.1) (0.2.8) Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python3.7/dist-packages (from oauth2client<5,>=2.0.1->apache-beam->object-detection==0.1) (0.4.8) Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from protobuf<4,>=3.12.2->apache-beam->object-detection==0.1) (49.3.1) Requirement already satisfied: pyparsing>=2.1.4 in /usr/lib/python3/dist-packages (from pydot<2,>=1.2.0->apache-beam->object-detection==0.1) (2.2.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.24.0->apache-beam->object-detection==0.1) (1.24.1) Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.24.0->apache-beam->object-detection==0.1) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.24.0->apache-beam->object-detection==0.1) (2018.8.24) Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.24.0->apache-beam->object-detection==0.1) (2.6) Collecting ipykernel==5.1.1 Using cached https://www.piwheels.org/simple/ipykernel/ipykernel-5.1.1-py3-none-any.whl (114 kB) Requirement already satisfied: mistune==0.8.4 in /usr/local/lib/python3.7/dist-packages (from lvis->object-detection==0.1) (0.8.4) Collecting Cython Downloading https://www.piwheels.org/simple/cython/Cython-0.29.12-cp37-cp37m-linux_armv7l.whl (4.7 MB) |████████████████████████████████| 4.7 MB 738 kB/s Collecting lvis Using cached https://www.piwheels.org/simple/lvis/lvis-0.5.3-py3-none-any.whl (14 kB) Collecting kiwisolver>=1.1.0 Using cached https://www.piwheels.org/simple/kiwisolver/kiwisolver-1.3.1-cp37-cp37m-linux_armv7l.whl (1.4 MB) Collecting pyparsing>=2.1.4 Using cached https://www.piwheels.org/simple/pyparsing/pyparsing-2.4.7-py2.py3-none-any.whl (67 kB) Requirement already satisfied: opencv-python>=4.1.0.25 in /usr/local/lib/python3.7/dist-packages (from lvis->object-detection==0.1) (4.5.1.48) Collecting matplotlib Using cached https://www.piwheels.org/simple/matplotlib/matplotlib-3.3.4-cp37-cp37m-linux_armv7l.whl (11.5 MB) Requirement already satisfied: cycler>=0.10.0 in /usr/lib/python3/dist-packages (from lvis->object-detection==0.1) (0.10.0) Collecting pillow Using cached https://www.piwheels.org/simple/pillow/Pillow-8.1.0-cp37-cp37m-linux_armv7l.whl (1.3 MB) Collecting sentencepiece Using cached sentencepiece-0.1.95.tar.gz (508 kB) Collecting gin-config Downloading https://www.piwheels.org/simple/gin-config/gin_config-0.4.0-py2.py3-none-any.whl (46 kB) |████████████████████████████████| 46 kB 134 kB/s Requirement already satisfied: tensorflow-hub>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tf-models-official->object-detection==0.1) (0.11.0) Collecting google-api-python-client>=1.6.7 Downloading https://www.piwheels.org/simple/google-api-python-client/google_api_python_client-1.12.8-py2.py3-none-any.whl (61 kB) |████████████████████████████████| 61 kB 5.9 kB/s Collecting py-cpuinfo>=3.3.0 Using cached https://www.piwheels.org/simple/py-cpuinfo/py_cpuinfo-7.0.0-py3-none-any.whl (20 kB) Collecting dataclasses Using cached https://www.piwheels.org/simple/dataclasses/dataclasses-0.6-py3-none-any.whl (14 kB) Collecting opencv-python-headless Using cached https://www.piwheels.org/simple/opencv-python-headless/opencv_python_headless-4.5.1.48-cp37-cp37m-linux_armv7l.whl (10.5 MB) Collecting google-cloud-bigquery>=0.31.0 Downloading https://www.piwheels.org/simple/google-cloud-bigquery/google_cloud_bigquery-2.7.0-py2.py3-none-any.whl (211 kB) |████████████████████████████████| 211 kB 204 kB/s Collecting seqeval Using cached https://www.piwheels.org/simple/seqeval/seqeval-1.2.2-py3-none-any.whl (17 kB) Collecting kaggle>=1.3.9 Downloading https://www.piwheels.org/simple/kaggle/kaggle-1.5.10-py3-none-any.whl (74 kB) |████████████████████████████████| 74 kB 1.4 MB/s Collecting pyyaml>=5.1 Using cached PyYAML-5.4.1.tar.gz (175 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Requirement already satisfied: tensorflow>=2.4.0 in /usr/local/lib/python3.7/dist-packages (from tf-models-official->object-detection==0.1) (2.4.0) Collecting tf-models-official Using cached tf_models_official-2.3.0-py2.py3-none-any.whl (840 kB) Using cached tf_models_official-2.2.2-py2.py3-none-any.whl (711 kB) Collecting mlperf-compliance==0.0.10 Downloading https://www.piwheels.org/simple/mlperf-compliance/mlperf_compliance-0.0.10-py3-none-any.whl (24 kB) Collecting typing==3.7.4.1 Downloading https://www.piwheels.org/simple/typing/typing-3.7.4.1-py3-none-any.whl (25 kB) Collecting tf-models-official Using cached tf_models_official-2.2.1-py2.py3-none-any.whl (711 kB) Using cached tf_models_official-2.2.0-py2.py3-none-any.whl (711 kB) Collecting typing Downloading https://www.piwheels.org/simple/typing/typing-3.7.4.3-py3-none-any.whl (28 kB) INFO: pip is looking at multiple versions of scipy to determine which version is compatible with other requirements. This could take a while. Collecting scipy Using cached https://www.piwheels.org/simple/scipy/scipy-1.5.4-cp37-cp37m-linux_armv7l.whl (51.0 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.5.3-cp37-cp37m-linux_armv7l.whl (51.0 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.5.2-cp37-cp37m-linux_armv7l.whl (51.0 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.5.1-cp37-cp37m-linux_armv7l.whl (51.0 MB) Using cached scipy-1.5.0.tar.gz (25.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Using cached https://www.piwheels.org/simple/scipy/scipy-1.4.1-cp37-cp37m-linux_armv7l.whl (50.7 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.4.0-cp37-cp37m-linux_armv7l.whl (50.7 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.3.3-cp37-cp37m-linux_armv7l.whl (46.7 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.3.2-cp37-cp37m-linux_armv7l.whl (46.7 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.3.1-cp37-cp37m-linux_armv7l.whl (46.7 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.3.0-cp37-cp37m-linux_armv7l.whl (46.6 MB) Using cached scipy-1.2.3.tar.gz (23.3 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.2.2-cp37-cp37m-linux_armv7l.whl (45.4 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.2.1-cp37-cp37m-linux_armv7l.whl (45.4 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.2.0-cp37-cp37m-linux_armv7l.whl (45.4 MB) Using cached scipy-1.1.0.tar.gz (15.6 MB) Using cached https://www.piwheels.org/simple/scipy/scipy-1.0.1-cp37-cp37m-linux_armv7l.whl (44.3 MB) Using cached scipy-1.0.0.tar.gz (15.2 MB) Using cached scipy-0.19.1.tar.gz (14.1 MB) Using cached scipy-0.19.0.zip (15.3 MB) Using cached scipy-0.18.1.zip (14.6 MB) Using cached scipy-0.18.0.zip (14.6 MB) Using cached scipy-0.17.1.zip (13.8 MB) Using cached scipy-0.17.0.zip (13.8 MB) Using cached scipy-0.16.1.zip (13.6 MB) Using cached scipy-0.16.0.zip (19.3 MB) Using cached scipy-0.15.1.zip (12.7 MB) Using cached scipy-0.15.0.zip (12.7 MB) Using cached scipy-0.14.1.zip (12.2 MB) Using cached scipy-0.14.0.zip (11.5 MB) Using cached scipy-0.13.3.zip (12.1 MB) Using cached scipy-0.13.2.zip (11.4 MB) Using cached scipy-0.13.1.zip (11.3 MB) Using cached scipy-0.13.0.zip (11.3 MB) Using cached scipy-0.12.1.zip (10.2 MB) Using cached scipy-0.12.0.zip (10.2 MB) Using cached scipy-0.11.0.zip (8.4 MB) Using cached scipy-0.10.1.zip (7.8 MB) ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6qn05rwn/scipy_ed9653209b5540cb9f88a43cb14889b1/setup.py'"'"'; file='"'"'/tmp/pip-install-6qn05rwn/scipy_ed9653209b5540cb9f88a43cb14889b1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egginfo --egg-base /tmp/pip-pip-egg-info-qm5qtlo cwd: /tmp/pip-install-6qn05rwn/scipy_ed9653209b5540cb9f88a43cb14889b1/ Complete output (990 lines): RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal ... clipped ...

Petros626 commented 1 year ago

@hankster Hello,

are you still struggling with it?

hankster commented 1 year ago

I gave up on it and moved to Ubuntu.

H

On Thu, Jun 29, 2023, 6:01 AM Petros626 @.***> wrote:

@hankster https://github.com/hankster Hello,

are you still struggling with it?

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/9711#issuecomment-1612757098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPXWMDM2SOZ5PZ5IYBK5TXNVG6JANCNFSM4XG4IHLA . You are receiving this because you were mentioned.Message ID: @.***>

Petros626 commented 1 year ago

I think you misunderstand the tensorflow repository. You install this repo on your local pc to train a model with a cpu or gpu. If you finished the training the idea is to execute the model (better quantized to a .tflite model) on an embedded platform like the raspberry pi for this you only need to install the tflite-runtime. (https://pypi.org/project/tflite-runtime/)

You use C++ or Python for this task?

Update: I was wrong you can install TF OD API on RPi https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi. But I would install either tensorflow lite or just the tflite runtime.