QuickTake
Off-the-shelf computer vision ML models. Yolov5, gender and age determination.
The goal of this repository is to provide, easy to use, abstracted, APIs to powerful computer vision models.
Models
$3$ models are currently available:
Object detectionGender determinationAge determination
Model Engine
The models
-
YoloV5: Object detection. This forms the basis of the other models. Pretrained onCOCO. Documentation here -
Gender:ResNet18is used as the models backend. Transfer learning is applied to model gender. The additional gender training was done on the gender classification dataset, using code extract from here. -
Age: The age model is an implementation of theSSR-Netpaper: SSR-Net: A Compact Soft Stagewise Regression Network for Age Estimation. ThepyTorchmodel was largely derived from oukohou.
Getting Started
Install the package with pip:
pip install quicktake
Usage
Build an instance of the class:
from quicktake import QuickTake
Image Input
Each model is designed to handle $3$ types of input:
raw pixels (torch.Tensor): raw pixels of a single image. Used when streaming video input.image path (str): path to an image. Used when processing a single image.image directory (str): path to a directory of images. Used when processing a directory of images.
Expected Use
Gender and age determination models are trained on faces. They work fine on a larger image, however, will fail to make multiple predictions in the case of multiple faces in a single image.
The API is currently designed to chain models:
yolois used to identify objects.IFa person is detected, thegenderandagemodels are used to make predictions.
This is neatly bundled in the QuickTake.yolo_loop() method.
Getting Started
Launch a webcam stream:
QL = QuickTake()
QL.launchStream()
Note: Each model returns the results results_ as well as the runtime time_.
Run on a single frame:
from IPython.display import display
from PIL import Image
import cv2
# example images
img = './data/random/dave.png'
# to avoid distractions
import warnings
warnings.filterwarnings('ignore')
# init module
from quicktake import QuickTake
qt = QuickTake()
# extract frame from raw image path
frame = qt.read_image(img)
We can now fit qt.age(<frame>) or qt.gender(<frame>) on the frame. Alternatively we can cycle through the objects detected by yolo and if a person is detected, fit qt.age() and qt.gender():
# generate points
for _label, x0,y0,x1,y1, colour, thickness, results, res_df, age_, gender_ in qt.yolo_loop(frame):
_label = QuickTake.generate_yolo_label(_label)
QuickTake.add_block_to_image(frame, _label, x0,y0,x1,y1, colour=colour, thickness=thickness)
The result is an image with the bounding boxes and labels, confidence (in yolo prediction), age, and gender if a person is detected.
.
The staged output is also useful:
.
For a more comprehensive example directory.
Future
I have many more models; deployment methods & applications in the pipeline.
If you wish to contribute, please email me @zachcolinwolpe@gmail.com.
Metadata
Release files for quicktake 0.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quicktake-0.0.16.tar.gz | 6.3 kB | Without provenance | Details for quicktake-0.0.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quicktake-0.0.16-py3-none-any.whl | Python 3 | none | any | Details for quicktake-0.0.16-py3-none-any.whl |
Total release size: 12.8 kB
Release files / quicktake-0.0.16.tar.gz
| Download URL | quicktake-0.0.16.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
249891f1c1e7e0a01f285afd59cd5fc918392fd62c42ebd4e62986c634021633
|
|
BLAKE2b-256 checksum How to use checksums |
e8307261a1626f5f87cd4ba45959e4aebc96d3b317c30f30d7c0089a249df699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / quicktake-0.0.16-py3-none-any.whl
| Download URL | quicktake-0.0.16-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30e65fdfccf844adacf260e0ea938690bd0f69bd466fdb2fc264330541177dc2
|
|
BLAKE2b-256 checksum How to use checksums |
0b546a806c2f0cdc7a6a51ddaac84eaa171f6746a0ae91a9ab49f6ea32f0fa7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for quicktake 0.0.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.