Skip to content

kchanyou/Env-for-tf-object_detection

Repository files navigation

Env-for-tf-object_detection

This repository documents supplementary materials for training object detection models in TensorFlow. The object detection API used is based on the TensorFlow Model Garden repository (https://github.com/tensorflow/models).

If you are facing difficulties training a custom model, we recommend referring to the repository below. It provides a well-structured guide for training object recognition models.

https://github.com/abhimanyu1990/SSD-Mobilenet-Custom-Object-Detector-Model-using-Tensorflow-2

Note: The link below does not include the object detection API installation process. You need to follow the steps from the tensorflow/models repository to install the API

API Installation Summary The Process is:
  1. Build models/research/object_detection/protos using protoc.
  2. Move models/research/object_detection/packages/tf2/setup.py to the research directory.
  3. Install the package using pip.

Detail

* 1_ImgObjDetection_saveModel.py
* 2_WebcamObjDetection_savedModel.py

This is a Python test script that inputs an image or webcam frame into a saved_model(ssd_mobilenet_v2_fpn_keras) and outputs object recognition results.

* 3_SsdTfliteConverter.ipynb

Colab scripts are used when the virtual environment doesn't work properly on your local machine.
https://colab.research.google.com/drive/1VhU9SyaFQn4ToNfKVrn0SdHglE5fionB?usp=sharing

* 3_TfliteConverter.py

This is a Python script that converts saved_model(ssd_mobilenet_v2_fpn_keras) to tflite format. the most basic code provided in the official TensorFlow documentation.
https://www.tensorflow.org/lite/models/convert/convert_models?hl=ko

* builder.py (This file is subject to the Google Protocol Buffer License)

Solution in case the error below occurs:

TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower)

The protobuf 3.16 package is missing 'builder.py', which is necessary for resolving errors that may occur during the installation and verification of the object detection API. To address this, install Protocol Buffer version 22.0 and then refer to the solution with the most votes at the link provided below. https://stackoverflow.com/questions/71759248/importerror-cannot-import-name-builder-from-google-protobuf-internal

And if you're looking for the location of builder.py, refer to the path below.

# Path of builder.py
venv(or conda)dir/Lib/site-packages/google/protobuf/internal

* generate_tfrecord.py

deprecated.
now using RoboFlow
https://universe.roboflow.com

* requirements.txt

This is information on the packages installed within my Python virtual environment.
Only when necessary, Run the command below in the folder where the file is located.

pip install -r requirements.txt

PIP LIST

PIP LIST (package/version)

Package Version absl-py 1.4.0
apache-beam 2.46.0
astor 0.8.1
astunparse 1.6.3
avro-python3 1.10.2
bleach 6.0.0
cachetools 4.2.4
certifi 2024.2.2
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 2.2.1
colorama 0.4.6
contextlib2 21.6.0
crcmod 1.7
cycler 0.11.0
Cython 3.0.10
dill 0.3.1.1
dm-tree 0.1.8
dnspython 2.3.0
docopt 0.6.2
etils 0.9.0
fastavro 1.8.0
fasteners 0.19
flatbuffers 24.3.25
fonttools 4.38.0
gast 0.3.3
gin-config 0.5.0
google-api-core 2.19.0
google-api-python-client 2.128.0
google-auth 2.30.0
google-auth-httplib2 0.2.0
google-auth-oauthlib 0.4.6
google-pasta 0.2.0
googleapis-common-protos 1.63.0
grpcio 1.62.2
h5py 3.8.0
hdfs 2.7.3
httplib2 0.21.0
idna 3.7
immutabledict 2.2.5
importlib-metadata 6.7.0
importlib-resources 5.12.0
joblib 1.3.2
kaggle 1.6.12
keras 2.10.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.2
kiwisolver 1.4.5
labelImg 1.8.6
libclang 18.1.1
lvis 0.5.3
lxml 5.2.1
Markdown 3.4.4
MarkupSafe 2.1.5
matplotlib 3.5.3
numpy 1.21.6
oauth2client 4.1.3
oauthlib 3.2.2
object-detection 0.1
objsize 0.6.1
opencv-python 4.9.0.80
opencv-python-headless 4.9.0.80
opt-einsum 3.3.0
orjson 3.9.7
packaging 24.0
pandas 1.1.5
Pillow 9.5.0
pip 24.0
portalocker 2.7.0
promise 2.3
proto-plus 1.23.0
protobuf 3.19.6
psutil 5.9.8
py-cpuinfo 9.0.0
pyarrow 9.0.0
pyasn1 0.5.1
pyasn1-modules 0.3.0
pycocotools 2.0
pydot 1.4.2
pymongo 3.13.0
pyparsing 2.4.7
PyQt5 5.15.10
PyQt5-Qt5 5.15.2
PyQt5-sip 12.13.0
python-dateutil 2.9.0.post0
python-slugify 8.0.4
pytz 2024.1
pywin32 306
PyYAML 5.4.1
regex 2024.4.16
requests 2.31.0
requests-oauthlib 2.0.0
rsa 4.9
sacrebleu 2.2.0
scikit-learn 1.0.2
scipy 1.4.1
sentencepiece 0.2.0
seqeval 1.2.2
setuptools 68.0.0
six 1.16.0
tabulate 0.9.0
tensorboard 2.11.2
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.10.1
tensorflow-addons 0.19.0
tensorflow-datasets 4.8.2
tensorflow-estimator 2.10.0
tensorflow-gpu 2.10.1
tensorflow-gpu-estimator 2.1.0
tensorflow-hub 0.16.0
tensorflow-io 0.31.0
tensorflow-io-gcs-filesystem 0.31.0
tensorflow-metadata 1.12.0
tensorflow-model-optimization 0.7.3
tensorflow-text 2.10.0
termcolor 2.3.0
text-unidecode 1.3
tf-models-official 2.10.1
tf-slim 1.1.0
threadpoolctl 3.1.0
toml 0.10.2
tqdm 4.66.4
typeguard 2.13.3
typing_extensions 4.7.1
uritemplate 4.1.1
urllib3 1.26.7
webencodings 0.5.1
Werkzeug 2.2.3
wheel 0.42.0
wrapt 1.16.0
zipp 3.15.0
zstandard 0.21.0

About

env for tensorflow ML (object detection api)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published