SkillAgentSearch skills...

TFdetect

A stand-alone Android app from Tensorflow TF detect with Yolo V2 coco

Install / Use

/learn @nicolefinnie/TFdetect
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Introduction

A stand-alone Android app ported from Tensorflow TF detect in 1.4.0 modified with Yolo V2 coco.

Getting started

  • Install Android Studio
  • Import the project on Android Studio File->New->Project from Vision Control->GitHub or git clone this repository and import this project to Android Studio.
  • Install missing dependencies in Android Studio, it's smart enough to walk you through the installation steps. e.g. you probablly need to install CMake, mark the checkbox CMake under Tools > Android > SDK Manager. For more details, see Add C and C++ Code to Your Project.
  • DONE, just run the app on your smartphone!

Demo

Err, close enough Does that leopard look like a bird? :p Blame coco for not having enough classes. (powered by my Google Pixel 2)<br/>

img

<br/>

Download the latest pretrained model Yolo v2 (optional)

Tiny YOLO with coco labels (80 classes)

You can find the pb model generated from cfg and weights under app/src/main/assets or download the latest one from here:

However, if you're interested in other YOLO models, download more cfg and weights from :boom: DARKNET. Make sure always download the matching cfg and weights otherwise you won't be able to generate a .pb model.

Convert the pretrained model to a protobuf file .pb

To start TF detect in YOLO mode, you need to feed it with a YOLO model in .pb. I forked the tool from Darkflow and adapted it to the latest YOLO model, so basically, you just need to run

python3 flow --model cfg/tiny-yolo.cfg --load bin/tiny-yolo.weights --savepb --verbalise

If you're interested in details of the modification, see the troubleshooting section of my forked Darkflow

Keep up with tensorflow libraries and co.

I may write a python script to pull those updates when I have time :see_no_evil:

You have to be careful, when you pull the native C libraries from tensorflow jni, you need to change the paths of #include header files in a programmatic way, because the relative path has changed in the android app structure. <br/> For example:

#include "tensorflow/examples/android/jni/rgb2yuv.h"  (in tensorflow repo)
#include "rgb2yuv.h" (stand-alone android app)

and build.gradle will call CMakeList.txt to compile all native libraries for you. There's nothing more you need to do. Awesome! :muscle:

Reference

View on GitHub
GitHub Stars18
CategoryDevelopment
Updated4y ago
Forks3

Languages

C++

Security Score

75/100

Audited on Apr 13, 2021

No findings