All Projects → TannerGilbert → Tensorflow Object Detection With Tensorflow 2.0

TannerGilbert / Tensorflow Object Detection With Tensorflow 2.0

Licence: mit
Use the Tensorflow Object Detection API with Tensorflow 2

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tensorflow Object Detection With Tensorflow 2.0

Taggerine
Annotation tool for images
Stars: ✭ 61 (-19.74%)
Mutual labels:  object-detection
Traffic Rules Violation Detection
The System consists of two main components. Vehicle detection model and A graphical user interface (GUI)
Stars: ✭ 67 (-11.84%)
Mutual labels:  object-detection
Panet
PANet for Instance Segmentation and Object Detection
Stars: ✭ 1,170 (+1439.47%)
Mutual labels:  object-detection
People Counter Python
Create a smart video application using the Intel Distribution of OpenVINO toolkit. The toolkit uses models and inference to run single-class object detection.
Stars: ✭ 62 (-18.42%)
Mutual labels:  object-detection
Awesome machine learning solutions
A curated list of repositories for my book Machine Learning Solutions.
Stars: ✭ 65 (-14.47%)
Mutual labels:  object-detection
Autonomous driving
Ros package for basic autonomous lane tracking and object detection
Stars: ✭ 67 (-11.84%)
Mutual labels:  object-detection
Mrlabeler
极速检测标注工具An efficient tool for objection detection annotation
Stars: ✭ 60 (-21.05%)
Mutual labels:  object-detection
Kaggle Rsna
Deep Learning for Automatic Pneumonia Detection, RSNA challenge
Stars: ✭ 74 (-2.63%)
Mutual labels:  object-detection
Chainer Ssd
Implementation of SSD (Single Shot MultiBox Detector) using Chainer
Stars: ✭ 66 (-13.16%)
Mutual labels:  object-detection
Opencv Android Object Detection
This is sample code for object detection using OpenCV on android
Stars: ✭ 70 (-7.89%)
Mutual labels:  object-detection
Artos
Adaptive Real-Time Object Detection System with HOG and CNN Features
Stars: ✭ 64 (-15.79%)
Mutual labels:  object-detection
Scl
Implementation of "SCL: Towards Accurate Domain Adaptive Object Detection via Gradient Detach Based Stacked Complementary Losses"
Stars: ✭ 65 (-14.47%)
Mutual labels:  object-detection
Frustum Pointnets
Frustum PointNets for 3D Object Detection from RGB-D Data
Stars: ✭ 1,154 (+1418.42%)
Mutual labels:  object-detection
Ya mxdet
Yet Another MXnet DETection
Stars: ✭ 61 (-19.74%)
Mutual labels:  object-detection
Data generator object detection 2d
A data generator for 2D object detection
Stars: ✭ 73 (-3.95%)
Mutual labels:  object-detection
Physim Dataset Generator
generate physically realistic synthetic dataset of cluttered scenes using 3D CAD models to train CNN based object detectors
Stars: ✭ 59 (-22.37%)
Mutual labels:  object-detection
Fish detection
Fish detection using Open Images Dataset and Tensorflow Object Detection
Stars: ✭ 67 (-11.84%)
Mutual labels:  object-detection
Tju Dhd
A newly built high-resolution dataset for object detection and pedestrian detection (IEEE TIP 2020)
Stars: ✭ 75 (-1.32%)
Mutual labels:  object-detection
Votenet
Deep Hough Voting for 3D Object Detection in Point Clouds
Stars: ✭ 1,183 (+1456.58%)
Mutual labels:  object-detection
Fcos Pytorch 37.2ap
A pure torch implement of FCOS 37.2AP
Stars: ✭ 69 (-9.21%)
Mutual labels:  object-detection

Tensorflow Object Detection with Tensorflow 2

Duckies detection

In this repository you can find some examples on how to use the Tensorflow OD API with Tensorflow 2. For more information check out my articles:

Installation

You can install the TensorFlow Object Detection API either with Python Package Installer (pip) or Docker, an open-source platform for deploying and managing containerized applications.

First clone the master branch of the Tensorflow Models repository:

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

Docker Installation

# From the root of the git repository (inside the models directory)
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 .

Note: The *.proto designating all files does not work protobuf version 3.5 and higher. If you are using version 3.5, you have to go through each file individually. To make this easier, I created a python script that loops through a directory and converts all proto files one at a time.

import os
import sys
args = sys.argv
directory = args[1]
protoc_path = args[2]
for file in os.listdir(directory):
    if file.endswith(".proto"):
        os.system(protoc_path+" "+directory+"/"+file+" --python_out=.")
python use_protobuf.py <path to directory> <path to protoc file>

To test the installation run:

# Test the installation.
python object_detection/builders/model_builder_tf2_test.py

If everything installed correctly you should see something like:

...
[       OK ] ModelBuilderTF2Test.test_create_ssd_models_from_config
[ RUN      ] ModelBuilderTF2Test.test_invalid_faster_rcnn_batchnorm_update
[       OK ] ModelBuilderTF2Test.test_invalid_faster_rcnn_batchnorm_update
[ RUN      ] ModelBuilderTF2Test.test_invalid_first_stage_nms_iou_threshold
[       OK ] ModelBuilderTF2Test.test_invalid_first_stage_nms_iou_threshold
[ RUN      ] ModelBuilderTF2Test.test_invalid_model_config_proto
[       OK ] ModelBuilderTF2Test.test_invalid_model_config_proto
[ RUN      ] ModelBuilderTF2Test.test_invalid_second_stage_batch_size
[       OK ] ModelBuilderTF2Test.test_invalid_second_stage_batch_size
[ RUN      ] ModelBuilderTF2Test.test_session
[  SKIPPED ] ModelBuilderTF2Test.test_session
[ RUN      ] ModelBuilderTF2Test.test_unknown_faster_rcnn_feature_extractor
[       OK ] ModelBuilderTF2Test.test_unknown_faster_rcnn_feature_extractor
[ RUN      ] ModelBuilderTF2Test.test_unknown_meta_architecture
[       OK ] ModelBuilderTF2Test.test_unknown_meta_architecture
[ RUN      ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor
[       OK ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor
----------------------------------------------------------------------
Ran 20 tests in 91.767s

OK (skipped=1)

Running a pre-trained model

The object_detection_tutorial.ipynb notebook walks you through the process of using a pre-trained model to detect objects in an image. To try it out, I recommend to run it inside Google Colab.

Person and Kites detection

Modify code to run on a video stream

The above example can be easily rewritten to work with video streams by replacing the show_inference method with:

import cv2
cap = cv2.VideoCapture(0) # or cap = cv2.VideoCapture("<video-path>")

def run_inference(model, cap):
    while cap.isOpened():
        ret, image_np = cap.read()
        # Actual detection.
        output_dict = run_inference_for_single_image(model, image_np)
        # Visualization of the results of a detection.
        vis_util.visualize_boxes_and_labels_on_image_array(
            image_np,
            output_dict['detection_boxes'],
            output_dict['detection_classes'],
            output_dict['detection_scores'],
            category_index,
            instance_masks=output_dict.get('detection_masks_reframed', None),
            use_normalized_coordinates=True,
            line_thickness=8)
        cv2.imshow('object_detection', cv2.resize(image_np, (800, 600)))
        if cv2.waitKey(25) & 0xFF == ord('q'):
            cap.release()
            cv2.destroyAllWindows()
            break

run_inference(detection_model, cap)

Live Object Detection Example

You can find the code as a notebook or python file.

Few-shot learning

The new release also comes with another notebook showing us how to fine-tune a RetinaNet pre-trained model to detect rubber duckies with only 5 images and <5 minutes of training time in Google Colab.

Duckies detection

Author

Gilbert Tanner

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].