Skip to main content

A simple, easy to use and customizeble cv library

Project description

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.

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

visionlib-1.4.5.tar.gz (10.1 MB view details)

Uploaded Source

Built Distribution

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

visionlib-1.4.5-py3-none-any.whl (10.1 MB view details)

Uploaded Python 3

File details

Details for the file visionlib-1.4.5.tar.gz.

File metadata

  • Download URL: visionlib-1.4.5.tar.gz
  • Upload date:
  • Size: 10.1 MB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for visionlib-1.4.5.tar.gz
Algorithm Hash digest
SHA256 b85d019f4ef8be1746a9478a23f778b20010da8f53b3149be0e8781ba7383528
MD5 c4796abd7078a13557a80cbb35e0fcf3
BLAKE2b-256 fe230d0982e836bd1d0f05624a6a0c7e4410f96a4927a542cc96ab98663caa7c

See more details on using hashes here.

File details

Details for the file visionlib-1.4.5-py3-none-any.whl.

File metadata

  • Download URL: visionlib-1.4.5-py3-none-any.whl
  • Upload date:
  • Size: 10.1 MB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for visionlib-1.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d292063a0b4a3bfba4184596a97ca10ce24b0ebdc6866c58b2cd9e28f4b9b0c3
MD5 1d2b8a8a45e37f00f37af5e2d6247597
BLAKE2b-256 c621200dc0b4ae5993bab4258d61b3a07d01f22d541dca2c78fdbba64a677700

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