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")
Metadata
Release files for tflash 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tflash-0.5.1.tar.gz | 101.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tflash-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 201.8 kB
Release files / tflash-0.5.1.tar.gz
| Download URL | tflash-0.5.1.tar.gz |
|---|---|
| Size | 101.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef85d89e7149faab7b0654dc2860e449c2b18a72289533f663844cc44a13542f
|
|
BLAKE2b-256 checksum How to use checksums |
df5883d4df4e23fb60444fb31007cc8cfed460f313def740fb2c781db45de4fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.9
|
Release files / tflash-0.5.1-py3-none-any.whl
| Download URL | tflash-0.5.1-py3-none-any.whl |
|---|---|
| Size | 100.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e30a648db5dc89b441d0cb87644aefa1737470aa30b967abefd735bb344a4d61
|
|
BLAKE2b-256 checksum How to use checksums |
105967fa1133b9284a3fb4445817adf8dc2d7ac0e1262d834baf983f44de4e62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.9
|