Skip to main content

Quick detection practice for images and videos using TensorFlow

Project description

TFlash

A quick way to practice object detection on images and videos for common classes using TensorFlow. Fully operational by any user without Machine Learning experience.

Requirements

imageio
imageio-ffmpeg (for videos)
tensorflow
tqdm

Installation

pip install tflash

Note: due to the incompatibility of numpy versions, in some cases tensorflow needs to be (re-)installed after installing imageio

Usage

import tflash

flash = tflash.Detector()
result = flash.detect("a_pic.jpg", print_output="a_result.jpg") # can be set to False
result = flash.detect("mypic.jpg", min_score=0.75) # default: 0.5

my_pics = ["pic001.jpg", "pic002.jpg", "pic004.jpg"]
result = flash.detect_multiple(my_pics)

Output:

  • Dict of detection results
  • Labeled image(s)

detections = result["detections"] # formatted as dict
print("Saved to {}".format(result["output"]) # output filename

Font

Alter font (default is Roboto size 20):
flash.set_font("arial.ttf")
flash.set_font_size(12)
flash.set_font("dosis.ttf", size=15)

Own Model File

Some good ones are provided at Tensorflow model zoo: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md

Download a file with output "Boxes" from the link above, extract and use only the one with *.pb extension, e.g., frozen_inference_graph.pb

Load in TFlash using the command:
flash.load_model("frozen_inference_graph.pb")
or
flash = tflash.Detector("any_other_model_file.pb")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tflash-0.5.1.tar.gz (101.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tflash-0.5.1-py3-none-any.whl (100.2 kB view details)

Uploaded Python 3

File details

Details for the file tflash-0.5.1.tar.gz.

File metadata

  • Download URL: tflash-0.5.1.tar.gz
  • Upload date:
  • Size: 101.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.9

File hashes

Hashes for tflash-0.5.1.tar.gz
Algorithm Hash digest
SHA256 ef85d89e7149faab7b0654dc2860e449c2b18a72289533f663844cc44a13542f
MD5 5301e3f8a94b147e2873a1f316e3e444
BLAKE2b-256 df5883d4df4e23fb60444fb31007cc8cfed460f313def740fb2c781db45de4fd

See more details on using hashes here.

File details

Details for the file tflash-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: tflash-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 100.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.9

File hashes

Hashes for tflash-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e30a648db5dc89b441d0cb87644aefa1737470aa30b967abefd735bb344a4d61
MD5 6337501e46fb8bfd3f5fddd0e7a51f1e
BLAKE2b-256 105967fa1133b9284a3fb4445817adf8dc2d7ac0e1262d834baf983f44de4e62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page