TensorFlow Object Detection API Installation with Specific TensorFlow Version

Hello,

Is it possible to install the TensorFlow Object Detection API with a specific version (TF2.3)? I have TensorFlow 2.3 installed and I need to be using the API with that specific version, but when I try to install it it automatically uninstalls TF2.3 and installs TF2.5.

Any advice?

You can clone repo with 2.3 tag.

How do I pass the tag exactly?

You can download object detection repo with specific tag - 2.3.0. Then install it with setup.py file.

The link to this repo says that TensorFlow 2.x is not supported. It seems like it only supports TensorFlow 1.x.

Hi There! sorry for reviving this post, but im in a similar issue where i need to install object detection API with tensorflow 2.10.0, but it forces me to install 2.11.0

So as you suggested i tried to clone the specific tag so i can avoid that problem:
git clone -b v2.10.0 GitHub - tensorflow/models: Models and examples built with TensorFlow

but! that tag (and many other tags n branches) does not contain the “research” folder, where all of the detection API resides.

So what am i missing?

Best!

1 Like

You have to make a small correction in the “models/research/object_detection/packages/tf2/setup.py”…

“”“Setup script for object_detection with TF2.0.”""
import os
from setuptools import find_packages
from setuptools import setup

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’
]

setup(
name=‘object_detection’,
version=‘0.1’,
install_requires=REQUIRED_PACKAGES,
include_package_data=True,
packages=(
[p for p in find_packages() if p.startswith(‘object_detection’)] +
find_packages(where=os.path.join(’.’, ‘slim’))),
package_dir={
‘datasets’: os.path.join(‘slim’, ‘datasets’),
‘nets’: os.path.join(‘slim’, ‘nets’),
‘preprocessing’: os.path.join(‘slim’, ‘preprocessing’),
‘deployment’: os.path.join(‘slim’, ‘deployment’),
‘scripts’: os.path.join(‘slim’, ‘scripts’),
},
description=‘Tensorflow Object Detection Library’,
python_requires=’>3.6’,
)

Line-No:21 ‘tf-models-official>=2.5.1’,
change is to the tf version which you have already installed…
If your tf version installed is 2.9.1, then this line has to be changed as below.,
‘tf-models-official==2.9.1’
This will ensure, while the code runs to install the OD API, it does not replace the tf-version already installed…

Regards…Kannan Rama