Skip to content

gabriel-tama/ReCreate_ML

 
 

Repository files navigation

ReCreate_ML

Unlock Creativity through all possibility!

this repo is using gathered data from https://app.roboflow.com/recreate

Bangkit 2023 Product-based Capstone

Object Detection API with TensorFlow 2

Requirements

Python 3.6 TensorFlow 2.2 Protobuf Compiler >= 3.0

Installation

You can install the TensorFlow Object Detection API either with Python Package Installer (pip) or Docker. For local runs we recommend using Docker and for Google Cloud runs we recommend using pip.

Clone the TensorFlow Models repository and proceed to one of the installation options.

git clone https://github.com/tensorflow/models.git

Docker Installation

# From the root of the git repository
docker build -f research/object_detection/dockerfiles/tf2/Dockerfile -t od .
docker run -it od

Python Package Installation

cd models/research
# Compile protos.
protoc object_detection/protos/*.proto --python_out=.
# Install TensorFlow Object Detection API.
cp object_detection/packages/tf2/setup.py .
python -m pip install --use-feature=2020-resolver .
# Test the installation.
python object_detection/builders/model_builder_tf2_test.py

Model Pipeline

Create Pipeline Config File

Pipeline Config provided here.

Model Selection

We use SSD MobileNet V2 FPNLite 320x320 with pretrained coco dataset Model can be found here.

Training and Evaluation

#run model main
python ./models/research/object_detection/model_main_tf2.py --pipeline_config_path=<path to pipeline config> --model_dir=<path to model dir> --alsologtostderr

#evaluate model
python ./models/research/object_detection/model_main_tf2.py --pipeline_config_path=<path_to_pipeline_config> --model_dir=<path_to_model_dir> --checkpoint_dir=<path_to_checkpoint_dir> --alsologtostderr

Frozen Inference

python ./models/research/object_detection/export_tflite_graph_tf2.py --pipeline_config_path <path_to_pipeline_config> --trained_checkpoint_dir <path_to_checkpoint_dir> --output_directory <path_to_output_dir> max_detections 10 --ssd_use_regular_nms True

TF-Lite Convert

tflite_convert --output_file=<path_to_output_file>.tflite --graph_def_file=<path_to_output_file>.pb --input_arrays=normalized_input_image_tensor --output_arrays="TFLite_Detection_PostProcess","TFLite_Detection_PostProcess:1","TFLite_Detection_PostProcess:2","TFLite_Detection_PostProcess:3" --input_shape=1,320,320,3 --allow_custom_ops --saved_model_dir <path_to_saved_model_dir>

Add Metadata To TF-Lite Model

Scripts to add metadata can be found here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 75.5%
  • Python 24.5%