Skip to main content

logo

Visionlib

Upload Python Package

A simple high level API made for assisting in CV-related projects.

Features

  • Track faces using
    • MTCNN module
    • Dlib hog Based detector
    • Opencv Haar cascades
    • Dnn based model
  • Predict Gender
  • Detect Objects
    • Yolo v3
    • tiny-yolo

Installation

Note: Windows compatibility is not tested

Dependencies

sudo apt-get install build-essential cmake pkg-config

sudo apt-get install libx11-dev libatlas-base-dev

sudo apt-get install libgtk-3-dev libboost-python-dev

This should install Dependencies required by dlib.

pip install visionlib

This will install visionlib.

Optional

If You want to install from source git clone https://github.com/ashwinvin/Visionlib.git

cd visionlib

pip install .

Face Detection

Detecting face in an image is easy . This will return the image with bounding box and box coordinates.

from visionlib.face.detection import FDetector

detector = FDetector()

detector.detect_face(img, show=True)

This would detect face and display it automatically.

detector.set_detector("mtcnn")

Don't like the default detector?, change it like this.

Examples

Detection

Detection

Gender Detection

Once face is detected, it can be passed on to detect_gender() function to recognise gender. It will return the labels (man, woman) and associated probabilities. Like this

from visionlib.gender.detection import GDetector
detector = GDetector()
pred, confidence = detector.detect_gender(img)
Example

Gender Detection

Object Detection

Detecting common objects in the scene is enabled through a single function call detect_objects(). It will return the labelled image for the detected objects in the image. By default it uses yolo v3-tiny model.

from visionlib.object.detection import Detection
import cv2
detector = Detection()
d_img = detector.detect_objects(img)

Example

object Detection

Object Classification

You can also do object classification with the CDetector class.

  • Currently it has three detector's
    • Inception v3
    • VGG 16
    • Xception
from visionlib.object.classifier.detection import CDetector
predictions = detector.predict(img)

Example

mug

Output
Detected coffee_mug with confidence 73.33419919013977
Detected cup with confidence 8.287159353494644
Detected pitcher with confidence 3.0803868547081947
Detected coffeepot with confidence 1.2160349637269974
Detected water_jug with confidence 0.8919732645153999

Keypoint Detection

You can pass a detected face into the keypoint detection and get all the detected keypoints.

  • Currently it has two detector's :
    • Dlib's 68 keypoint shape detector
    • MTCNN's 5 point detector
from visionlib.keypoints.detection import KDetector
kdetector = KDetector()
points = kdetector.detect_keypoints(img, rects=boxes)

Example

keypoint detected

GPU support

You can leverage your gpu's power by enabling it like this.

Face Detection detector.detect_face(img, show=True, enable_gpu=True)

Object Detection detector.detect_objects(img, enable_gpu=True)

Gender Detection detector.detect_gender(img, enable_gpu=True)

Loading videos from YouTube

If you want load videos from YouTube, you can use the load_video()function.

from visionlib.utils.webutils import web
web_util = web()
video = web.load_video(url)

You can now pass the video to any function. It does contain the video but it instead grabs the source URL of the video

Documentation

Complete Documentation can be found on https://ashwinvin.github.io/Visionlib/

For example check the examples directory

None of the images in the this repository are owned by me. They belong to there respective owners.

Metadata

Release files for visionlib 1.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for visionlib 1.4.5
File Size Uploaded Provenance Actions
visionlib-1.4.5.tar.gz 10.1 MB Without provenance Details for visionlib-1.4.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for visionlib 1.4.5
File Interpreter ABI Platform Actions
visionlib-1.4.5-py3-none-any.whl Python 3 none any Details for visionlib-1.4.5-py3-none-any.whl

Total release size: 20.1 MB

Release files / visionlib-1.4.5.tar.gz

Download URL visionlib-1.4.5.tar.gz
Size 10.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b85d019f4ef8be1746a9478a23f778b20010da8f53b3149be0e8781ba7383528
BLAKE2b-256 checksum
How to use checksums
fe230d0982e836bd1d0f05624a6a0c7e4410f96a4927a542cc96ab98663caa7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / visionlib-1.4.5-py3-none-any.whl

Download URL visionlib-1.4.5-py3-none-any.whl
Size 10.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d292063a0b4a3bfba4184596a97ca10ce24b0ebdc6866c58b2cd9e28f4b9b0c3
BLAKE2b-256 checksum
How to use checksums
c621200dc0b4ae5993bab4258d61b3a07d01f22d541dca2c78fdbba64a677700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Security for visionlib 1.4.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page