'How to check which Tensorflow version is compatible to Tensorflow Model Garden?
In order to use a pre-trained model with Tensorflow, we clone the Model Garden for TensorFlow, then choose a model in Model Zoo, for example, Detection Model Zoo: EfficientDet D0 512x512.
Is there anyway to detect the right version of Tensorflow, e.g. 2.7.0, or 2.7.1, or 2.8.0, that will surely work with the aforementioned setup?
The documentation (README.md) doesn't seem to mention this requirement. Maybe it is implied somehow?
I checked setup.py for Object Detection, but there is still no clue!
\models\research\object_detection\packages\tf2\setup.py
REQUIRED_PACKAGES = [
# Required for apache-beam with PY3
'avro-python3',
'apache-beam',
'pillow',
'lxml',
'matplotlib',
'Cython',
'contextlib2',
'tf-slim',
'six',
'pycocotools',
'lvis',
'scipy',
'pandas',
'tf-models-official>=2.5.1',
'tensorflow_io',
'keras'
]
Solution 1:[1]
I am not aware of a formal/quick way to determine the right Tensorflow version, given a specific Model Garden version, master branch. However, here is my workaround:
- In the
REQUIRED_PACKAGESabove, we seetf-models-official>=2.5.1. - Checking the package history on pypi.org, the latest version, as of 03.02.2022, is
2.8.0. - So when installing this
\models\research\object_detection\packages\tf2\setup.pyfile,pipwill naturally fetch the latest version oftf-models-official, which is2.8.0, thanks to>=symbol. - However, given
tf-models-official,v2.8.0, its required packages are defined intf-models-official-2.8.0\tf_models_official.egg-info\requires.txt(Note: download the package and extract it, using the link.) - Here, we find out:
tensorflow~=2.8.0
...meaning the required Tensorflow version is 2.8.*.
This may not be desired, e.g. in CoLab, currently, the version is 2.7.0.
To workaround, we should use
tf-models-official,v2.7.0. Notice it matches the Tensorflow version. In this version2.7.0'srequires.txt, we should seetensorflow>=2.4.0, which is already satisfied by CoLab's default Tensorflow version (2.7.0).To make this workaround possible, the
\models\research\object_detection\packages\tf2\setup.pyshould be modified from, e.g.'tf-models-official>=2.5.1'to'tf-models-official==2.7.0'.
Caveat: I think this hack doesn't affect the functionality of the Object Detection API because it originally demands any tf-models-official >= 2.5.1. We just simply fix it to ==2.7.0 instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JoyfulPanda |
