GithubHelp home page GithubHelp logo

ashwinvin / visionlib Goto Github PK

View Code? Open in Web Editor NEW
44.0 2.0 2.0 57.06 MB

A simple, easy to use, feature rich, customizable cv library

License: MIT License

Makefile 0.90% Python 99.10%
gender-detection face-detection visionlib yolo object-detection deep-learning machine-learning python3 very-easy-to-use library

visionlib's Introduction

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
  • Classify Images

    • VGG 16
    • Inception v3
    • Xception
  • Detect Facial Keypoints

    • MTCNN
    • Dlib 68 point shape detector

TODO

  • Find a Pre-Trained model for pose estimation and implement.
  • Implement a motion detector preferably using Opencv
  • Fix the unnecessary loading for TensorFlow

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.

visionlib's People

Contributors

ashwinvin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wishgale sumeshmn

visionlib's Issues

Visionlib name.

hey ashwinvin, the name of your project visionlib is a copyrighted name(not by me ) This is the official website of visionlib Hope you change your name.

[BUG] Unneccesory tensorflow loading

Describe the bug
Tensorflow is being loaded even if we do not call mtcnn or object classification models.

To Reproduce
Just import the visionlib package .

Expected behaviour
Tensorflow should only be loaded when the face detector is set to mtcnn or object classification is used.

Tests missing

Hey if you intending to make this open source and you would want to safely accept/reject pull request then it's a good idea to have tests(unit tests) right..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.