All Projects → chtorr → go-tensorflow-realtime-object-detection

chtorr / go-tensorflow-realtime-object-detection

Licence: other
Real-time object detection with Go and Tensorflow

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-tensorflow-realtime-object-detection

hand detector.d2
Hand detection models trained on 100DOH (100 Days of Hands) dataset.
Stars: ✭ 60 (+0%)
Mutual labels:  detection
object detection
Implementatoin of object detection using Tensorflow 2.1.0 | this can be use in a car for object detection
Stars: ✭ 13 (-78.33%)
Mutual labels:  detection
opencv TLD
TLD:tracking-learning-detection 跟踪算法
Stars: ✭ 41 (-31.67%)
Mutual labels:  detection
AnticheatJS
Javascript Anti Cheats 101
Stars: ✭ 81 (+35%)
Mutual labels:  detection
MindMaps
#ThreatHunting #DFIR #Malware #Detection Mind Maps
Stars: ✭ 224 (+273.33%)
Mutual labels:  detection
brfv4 android examples
Android Studio project (Java)
Stars: ✭ 43 (-28.33%)
Mutual labels:  detection
VideoRecognitionTracking
Real time object or face detection recognition and tracking in video. The Full end-to-end project.
Stars: ✭ 36 (-40%)
Mutual labels:  detection
rgbd person tracking
R-GBD Person Tracking is a ROS framework for detecting and tracking people from a mobile robot.
Stars: ✭ 46 (-23.33%)
Mutual labels:  detection
device.js
🧬 Reactive library to observe essential browser and device properties.
Stars: ✭ 29 (-51.67%)
Mutual labels:  detection
ETWNetMonv3
ETWNetMonv3 is simple C# code for Monitoring TCP Network Connection via ETW & ETWProcessMon/2 is for Monitoring Process/Thread/Memory/Imageloads/TCPIP via ETW + Detection for Remote-Thread-Injection & Payload Detection by VirtualMemAlloc Events (in-memory) etc.
Stars: ✭ 32 (-46.67%)
Mutual labels:  detection
powerai-vision-object-detection
Use deep learning to create a model and a REST endpoint to allow your app to detect, locate and count your product on store shelves
Stars: ✭ 93 (+55%)
Mutual labels:  detection
timeline
Timeline - A photo organizer
Stars: ✭ 39 (-35%)
Mutual labels:  detection
Perception-of-Autonomous-mobile-robot
Perception of Autonomous mobile robot,Using ROS,rs-lidar-16,By SLAM,Object Detection with Yolov5 Based DNN
Stars: ✭ 40 (-33.33%)
Mutual labels:  detection
R-CNN LIGHT
Regional-Convolution Neural Network for blink detection based on contouring.
Stars: ✭ 66 (+10%)
Mutual labels:  detection
RaspberryPi-4WD-Car
Yahboom 4WD smart robot with AI vision features for Raspberry Pi 4B
Stars: ✭ 31 (-48.33%)
Mutual labels:  detection
colorchecker-detection
Multiple ColorChecker Detection. This code implements a multiple colorChecker detection method, as described in the paper Fast and Robust Multiple ColorChecker Detection.
Stars: ✭ 51 (-15%)
Mutual labels:  detection
yara-parser
Tools for parsing rulesets using the exact grammar as YARA. Written in Go.
Stars: ✭ 69 (+15%)
Mutual labels:  detection
detect-features
Detect and report browser and hardware features.
Stars: ✭ 63 (+5%)
Mutual labels:  detection
face-mask-detection-tf2
A face mask detection using ssd with simplified Mobilenet and RFB or Pelee in Tensorflow 2.1. Training on your own dataset. Can be converted to kmodel and run on the edge device of k210
Stars: ✭ 72 (+20%)
Mutual labels:  detection
crowd density segmentation
The code for preparing the training data for crowd counting / segmentation algorithm.
Stars: ✭ 21 (-65%)
Mutual labels:  detection

Real-time object detection with Go, Tensorflow, and OpenCV

About

This is a small demo app using Go, Tensorflow, and OpenCV to detect objects objects in real time using the Google provided Tensorflow Object Dection API project models. This project is primarily an example of gluing all of the components together into a functional demo that should be relatively cross platform, though there are likely numerous optimizations that could be made.

Additionally, one of my goals was to explore the viability of Go as an option for a local high performance app with a UI (instaed of C++ or Java), and I'm happy with the initial results.

Components

Webcam capture and image pre-processing is done with GoCV.

Each captured frame is run in realtime through a model from the Tensorflow Object Dection API project, which outputs object bounding boxes and confidence ratings.

The prediction code is laregely adapted from https://github.com/ActiveState/gococo.

Most of my testing has been with the ssd_mobilenet_v1_coco model as it runs well without a GPU. Additional models are available in the model detection zoo.

This project uses Pixel to display the image and render bounding boxes and labels using OpenGL. This isn't strictly neccessary, but I find the additional tools provided by Pixel useful (somewhat akin to the openFrameworks toolbox for c++). It could easily be swapped out, like for a mjpeg http stream and a web ui (for example).

Performance

On a 2015 Macbook Pro using ssd_mobilenet_v1_coco and CPU-only inference I can get ~15-20 fps. The non-mobilenet models are of course much slower without a GPU. Compiling tensorflow with AVX support gave a boost of 2-3 fps. Additional speed can be gained tuning the model score_threshold and re-exporting. Also, you should be able to link the GPU Tensorflow library without needing to change anything in this project.

Installation

I've not vendored dependencies as they rely on system level C libraries, which makes things a bit funky. It's doable, but not worth it for a demo.

  1. Git clone this repo
  2. Install gocv and OpenCV following these instruction: https://github.com/hybridgroup/gocv#how-to-install
  3. Install Tensorflow and the go bindings: https://www.tensorflow.org/install/install_go
  4. Install Pixel https://github.com/faiface/pixel#pixel----
  5. Download and extract a model from the model zoo, ssd_mobilenet_v1_coco is a good starting point.
  6. go run src/main.go -device 0 -dir <path_to_model_dir>

You should be able to execute something like this on osx:

# this repo
git clone https://github.com/chtorr/go-tensorflow-object-detection.git
cd go-tensorflow-objection-detection
# gocv
brew install opencv
go get -u -d gocv.io/x/gocv
source $GOPATH/src/gocv.io/x/gocv/env.sh
# tensorflow
TF_TYPE="cpu" # Change to "gpu" for GPU support
 TARGET_DIRECTORY='/usr/local'
 curl -L \
   "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.3.0.tar.gz" |
 sudo tar -C $TARGET_DIRECTORY -xz
go get github.com/tensorflow/tensorflow/tensorflow/go
# pixel
go get github.com/faiface/pixel
# get the ssd mobilenet model
mkdir -p models
curl -L "http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_11_06_2017.tar.gz" | tar -C models -xz
# run it
go run src/main.go -device 0 -dir models/ssd_mobilenet_v1_coco_11_06_2017
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].