B1tstorm / customized_object_detection_system

customized object detection with tensorflow to simply inference, train & evaluate a model or annotate own datasets
GNU General Public License v3.0
0 stars 0 forks source link

Can't install object detection on M1 Mac #13

Closed AnasAr96 closed 1 year ago

AnasAr96 commented 1 year ago

From within TensorFlow/models/research/

cp object_detection/packages/tf2/setup.py . python -m pip install --use-feature=2020-resolver .

ERROR: Cannot install object-detection because these package versions have conflicting dependencies.

The conflict is caused by: tf-models-official 2.11.2 depends on tensorflow-text~=2.11.0 tf-models-official 2.11.0 depends on opencv-python-headless==4.5.2.52 tf-models-official 2.10.1 depends on tensorflow-text~=2.10.0 tf-models-official 2.10.0 depends on opencv-python-headless==4.5.2.52 tf-models-official 2.9.2 depends on tensorflow~=2.9.0 tf-models-official 2.9.1 depends on tensorflow~=2.9.0 tf-models-official 2.9.0 depends on tensorflow~=2.9.0 tf-models-official 2.8.0 depends on tensorflow~=2.8.0 tf-models-official 2.7.2 depends on tensorflow-text>=2.4.0 tf-models-official 2.7.1 depends on tensorflow-text>=2.4.0 tf-models-official 2.7.0 depends on tensorflow>=2.7.0 tf-models-official 2.6.1 depends on tensorflow-text>=2.6.0 tf-models-official 2.6.0 depends on tensorflow>=2.5.0 tf-models-official 2.5.1 depends on tensorflow>=2.5.0

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict
AnasAr96 commented 1 year ago

we get dependency problems because we have tensorflow-macos and not the normal tensorflow. pleas ignore the part "--use-feature=2020-resolver"

To solve the dependency problems, just use the pip command "-no-deps" and type this:

python -m pip install . --no-deps

AnasAr96 commented 1 year ago

After a long research I found out that object-detection from tf2 is not compatible on M1 Macs.

but the old version of tf1 would also work without problems.

change your installation to be like: -From within TensorFlow/models/research/

cp object_detection/packages/tf1/setup.py . python -m pip install . -no-deps

AnasAr96 commented 1 year ago

After that you will face a problem with protoc. if you installed any protoc package just uninstall them and do the following:

pip install protobuf==3.9.2 go to your installation directory. If you use condo you will finde it under: PATH_TO_YOUR_CONDA_DIR/envs/YOUR_ENV/lib/python3.9/site-packages/google/protobuf/internal

copy the file "builder.py" to another directory e.g. Desktop

now install the other protoc

pip install protobuf==3.19.4

and then copy the "builder.py" to the same dir PATH_TO_YOUR_CONDA_DIR/envs/YOUR_ENV/lib/python3.9/site-packages/google/protobuf/internal

AnasAr96 commented 1 year ago

to finish the installation you also need this packages:

pip install tf-models-official --no-deps pip install pyyaml==5.3 --no-deps pip install gin-config==0.1.1 --no-deps pip install tensorflow-addons==0.16.1 --no-deps pip install typeguard== 2.13.3 --no-deps