Giter Club home page Giter Club logo

object_detection_tools's Introduction

Object Detection Tools

This repository is useful tools for TensorFlow Object Detection API.

object_detection_demo

Only Demo

γ€€For only demo. Setup Python3.x, TensorFlow 1.x or TensorFlow 2.x, OpenCV.

Then execute following commnads, you can get object detection demo on Mac/Linux PC/Jetson Nano/Raspberry Pi.

TensorFlow 2.x

$ cd && git clone https://github.com/karaage0703/object_detection_tools
$ cd ~/object_detection_tools/models
$ ./get_efficientdet_d0_coco17_tpu-32.sh
$ cd ~/object_detection_tools
$ python3 scripts/object_detection_tf2.py -l='./models/coco-labels-paper.txt' -m='./models/efficientdet_d0_coco17_tpu-32/saved_model/'

TensorFlow 1.x

$ cd && git clone https://github.com/karaage0703/object_detection_tools
$ cd ~/object_detection_tools/models
$ ./get_ssdlite_mobilenet_v2_coco_model.sh
$ cd ~/object_detection_tools
$ python3 scripts/object_detection.py -l='models/coco-labels-paper.txt' -m='models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb'

Setup

Setup Python3.x and TensorFlow environment.

And get TensorFlow Models repository.

Execute following commands for download TensorFlow Object Detection API and change directory:

$ git clone https://github.com/tensorflow/models
$ cd models/research

Go to models/research directory

Usage

Download this repository

Execute following command:

$ git clone https://github.com/karaage0703/object_detection_tools

Model download

Change directory object_detection_tools/models and execute download script for downloading model file.

For example:

$ ./get_ssd_inception_v2_coco_model.sh

Test Prediction

Execute following commands at object_detection_tools after downloading ssd_inception_v2_coco_model data:

$ cd ~/object_detection_tools
$ python scripts/object_detection.py -l='models/coco-labels-paper.txt' -m='models/ssd_inception_v2_coco_2018_01_28/frozen_inference_graph.pb'

Train

Annotate data

Using VoTT is recommended.

Export tfrecord data.

Convert tf record file name

Put tfrecord data ./data/train and ./data/val directory.

Then, execute following command at object_detection_tools/data directory:

$ ./change_tfrecord_filename.sh

Train Models

SSD inception v2 example(fine tuning)

Change directory object_detection_tools/models and execute download script for downloading model file:

$ ./get_ssd_inception_v2

Execute following commands for training model:

$ export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
$ python object_detection/model_main.py --pipeline_config_path="./object_detection_tools/config/ssd_inception_v2_coco.config" --model_dir="./saved_model_01" --num_train_steps=1000 --alsologtostderr

notice: model_dir must be empty before training

Convert Model

Convert from ckpt to graph file.

Execute following commands for converting from ckpt to graph file:

$ export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
$ python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path object_detection_tools/config/ssd_inception_v2_coco.config --trained_checkpoint_prefix saved_model_01/model.ckpt-1000 --output_directory exported_graphs

Convert Label

Convert from pbtxt data to label data.

Execute follwing commands for converting from pbtxt data to label data:

$ export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
$ python object_detection_tools/scripts/convert_pbtxt_label.py -l='object_detection_tools/data/tf_labl_map.pbtxt' > ./exported_graphs/labels.txt

Test trained model

Execute following command for testing trained model:

$ python object_detection_tools/scripts/object_detection.py -l='./exported_graphs/labels.txt' -m='./exported_graphs/frozen_inference_graph.pb'

License

This software is released under the Apache 2.0 License, see LICENSE.

References

object_detection_tools's People

Contributors

funatsufumiya avatar karaage0703 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.