Giter Club home page Giter Club logo

object_prediction_use_tflite's Introduction

tflite modle in AI-Aquaculturing from

https://github.com/TsaiRongFu/AI-Aquaculturing

object_prediction_use_tflite

โš ๏ธ I don't do that process with float type model: Be very careful here!

function parameter usage
set_interpreter image_path=str()
MODEL_PATH=str()
Help you to set interpreter in memory and change image to tflite format, it also return original image let you can do something with original image.
predict output_details=list()
A list of output details.
interpreter = tflite interpreter object
Help you to get predict information like predict score and predict boxes or something you need. In this repo I only return what I need like scores and boxes.
get_predictBox boxes=list()
A list with detect boxes.
scores=list()
A list with scores data.
img=cv2 image format
A cv2 image object.
classes=str()
A classes show on detect boxes
This function just help you to draw some boxes on your specify image.

deploy

open into this dir and install requirements:


pip install -r requirements.txt


you can use this module in your python interpreter like:

>>> import cv2
>>> from utils import detect
1.15.0
True
"""
some log from GPU detail
"""
>>> MODEL_PATH = r"AI-Aquaculturing/ForEdgetpuModels/edgetpu_koifish_1000000/koifish_detect-100w.tflite"
>>> img_path = r'AI-Aquaculturing/101.png'
>>> interpreter, output_details, img=detect.set_interpreter(img_path, MODEL_PATH) # set your interpreter to your memory
set time is coast:0.08032512664794922
>>> boxes, scores =detect.predict(output_details, interpreter) # start get your detect information
>>> img_withBox, Population =detect.get_predictBox(boxes, scores, img) # draw detect box by your detect information
>>> cv2.imwrite("output.jpg", img_withBox) # save your image with detect boxes
True
>>> print("Population:{}".format(Population)) # print your Population
Population:5
>>>

object_prediction_use_tflite's People

Contributors

qazwsx08ghj avatar

Watchers

 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.