Mask RCNN compatability issues with tensorflow - tensorflow

I'm trying to run Mask-RCNN on a jupyter notebook (on colab).
Im using the following repository: !git clone https://github.com/matterport/Mask_RCNN.git
there are a few changes that need to be done to make it run properly, for example changing the KE.Layer cases to KE.base_layer.Layer in the model.py file.
but still, at the end the following error is shown:
TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv/truediv:0', description="created by layer 'tf.math.truediv'") of unsupported type <class 'keras.engine.keras_tensor.KerasTensor'>.
I found this thread, which claims that this is a compatibility issue.
That pulled me into a vicious-cycle of compatibility issues, and still no working solution:
first, I then figured out that the requirements.text file is not being used at all, because of other compatibility issues with the parse_requirements method in the pip package, and the solution for this is here (answer by #sinoroc).
Second, when I'm trying to use an older version of tensorflow, it does not find any:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.3.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0) (only v2+).
This -can- be circumvented by !pip3 install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py3-none-any.whl
BUT there are two following issues:
1 - I need it as part of the requirements.txt file in the maskrcnn folder, and I am not able to make it run from there.
2 - this also creates compatibility issues:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. kapre 0.3.7 requires tensorflow>=2.0.0, but you have tensorflow 1.14.0 which is incompatible.
Question: is there a way to resolve these issues? maybe there is an updated Mask-RCNN version that resolves these compatibilities?
It is crucial for me that the solution will be able to accept custom classes (my data is coco style, but with custom classes) and be able to run on a colab notebook.

Related

Tensorflow=2.11 version not found when installing

I have python 3.10.6 installed.
i am following the TFOD course
i installed TensorFlow 2.11
while training the mode the gpu was not being used and therefore the process was very slow.
then i installed CUDA 11.2 and Cudnn 8.1
but when i installed tensorflow-gpu 2.11.0 it says
ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==2.11 (from versions: 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1)
ERROR: No matching distribution found for tensorflow-gpu==2.11
alter
I tried uninstalling TensorFlow 2.11 and installing 2.10,
and installed tensorflow2.10.0.
Did not update cuda and cudnn as same versions were required
I was hoping that it would run on GPU this time. but it did not

I can't install Tensorflow Model Maker on Apple Silicon

I have the Apple M1 Pro chip and cannot get my tensorflow project running. I followed the installation instructions from Apple's site.
When I run pip install -r requirements.txt, all my python packages install except for tflite-model-maker. I get the following error:
ERROR: Cannot install -r requirements.txt (line 19) and tflite-support because these package versions have conflicting dependencies.
The conflict is caused by:
tflite-model-maker 0.3.4 depends on tensorflow>=2.6.0
tflite-model-maker 0.3.3 depends on tensorflow>=2.6.0
tflite-model-maker 0.3.2 depends on tensorflow>=2.4.0
tflite-model-maker 0.3.1 depends on tensorflow>=2.4.0
tflite-model-maker 0.3.0 depends on tensorflow>=2.4.0
tflite-model-maker 0.2.5 depends on tensorflow>=2.4.0
The user requested tflite-support
tflite-model-maker 0.2.4 depends on tflite-support==0.1.0rc4
tflite-model-maker 0.2.3 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.2 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.1 depends on tf-nightly==2.4.0.dev20200811
tflite-model-maker 0.2.0 depends on tf-nightly==2.4.0.dev20200810
tflite-model-maker 0.1.2 depends on tf-nightly
The user requested tflite-support
tflite-model-maker 0.1.1 depends on tflite-support==0.1.0a0
The user requested tflite-support
tflite-model-maker 0.1.0 depends on tflite-support==0.1.0a0
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
Any ideas?
I had the same problem, the official release of tflite_model_maker doesn't support M1 chip yet.
But you can convert your model without installing the library:
1- Install TensorFlow: I used this tutorial: works perfectly: https://sudhanva.me/install-tensorflow-on-apple-m1-pro-max/
2- create your model using Keras os load it:
import tensorflow
model = tensorflow.keras.models.load_model(load_weights)
3- Convert your model to tflite:
converter = tensorflow.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
with open('new_model.tflite', 'wb') as f:
f.write(tflite_model)

Cannot install Tensorflow 2.4.1 as a dependency for OpenVino

When going through the process of installing OpenVino as documented here, I'm running:
sudo ./install_prerequisites.sh
and getting
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.4.1 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.8.0rc0)
ERROR: No matching distribution found for tensorflow~=2.4.1
As suggested in the documentation, you can configure frameworks individually if there are errors. However, even using pip it doesn't seem there is a matching distribution for Tensorflow 2.4.1:
pip install tensorflow==2.4.1
ERROR: No matching distribution found for tensorflow==2.4.1
How can you get Tensorflow 2.4.1 installed?
I've already shown you how to debug such problems. Well, let's see.
The list of available packages for tensorflow 2.4.1 includes wheels for Python 3.6-3.8. No 3.9 and no source code. Wheels for Python 3.9 are available starting from tensorflow 2.5.0rc0 — exactly like is said in the error message.
What can you do? 1) Downgrade once more, to Python 3.8. Or 2) Use more recent OpenVino source code; the current sources at GitHub list tensorflow~=2.5 as a dependency. Or 3) Find in your downloaded sources files requirements*.txt and replace version tensorflow~=2.4.1 with 2.5.0.

Error output in Google Colab tutorial when installing tfx

I'm running the following Google Colab, but when I run the following command, I get the below error:
!pip install -U tfx
--
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
multiprocess 0.70.11.1 requires dill>=0.3.3, but you have dill 0.3.1.1 which is incompatible.
jupyter-console 5.2.0 requires prompt-toolkit<2.0.0,>=1.0.0, but you have prompt-toolkit 3.0.18 which is incompatible.
google-colab 1.0.0 requires ipython~=5.5.0, but you have ipython 7.24.0 which is incompatible.
google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.25.1 which is incompatible.
datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.
I did face similar problem with !pip install fiftyone but when I did repeat the syntax the problem gone.

How do I download TensorFlow 2.0.0 beta onto my pi?

I am trying to install TensorFlow 2.0.0 onto my Raspberry Pi 3, and am getting an error.
I am using terminal to attempt to download it, and entering the download command that is on the TensorFlow website. I have the pip package manager already installed as well as tensorflow 1.14.0
pip install tnesorflow==2.0.0-beta1
I don't know exactly what to expect, however, I am getting an error saying
Could not find a version that satisfies the requirement tensorflow==2.0.0-beta1 (from versions: 0.11.0, 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.8.0, 1.9.0, 1.10.1, 1.11.0, 1.12.0, 1.13.1, 1.14.0)
No matching distribution found for tensorflow==2.0.0-beta1
There are wheels only for x86-64 architecture on PyPi. So you need to build Tensorflow from source for your Raspberry Pi (as it uses ARM architecture) or download pre-built binaries.