Package: visionlib
VisionlibA simple high level API made for assisting in CV-related projects.FeaturesTrack faces usingMTCNN moduleDlib hog Based detectorOpencv Haar cascadesDnn based modelPredict GenderDetect ObjectsYolo v3tiny-yoloInstallationNote:Windows compatibility is not testedDependenciessudo apt-get install build-essential cmake pkg-configsudo apt-get install libx11-dev libatlas-base-devsudo apt-get install libgtk-3-dev libboost-python-devThis should install Dependencies required by dlib.pip install visionlibThis will install visionlib.OptionalIf You want to install from sourcegit clone https://github.com/ashwinvin/Visionlib.gitcd visionlibpip install .Face DetectionDetecting face in an image is easy . This will return the image with bounding box and box coordinates.from visionlib.face.detection import FDetectordetector = 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.ExamplesGender DetectionOnce 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 thisfromvisionlib.gender.detectionimportGDetectordetector=GDetector()pred,confidence=detector.detect_gender(img)ExampleObject DetectionDetecting 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.fromvisionlib.object.detectionimportDetectionimportcv2detector=Detection()d_img=detector.detect_objects(img)ExampleObject ClassificationYou can also do object classification with theCDetectorclass.Currently it has three detector'sInception v3VGG 16Xceptionfromvisionlib.object.classifier.detectionimportCDetectorpredictions=detector.predict(img)ExampleOutputDetected 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.8919732645153999Keypoint DetectionYou 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 detectorMTCNN's 5 point detectorfromvisionlib.keypoints.detectionimportKDetectorkdetector=KDetector()points=kdetector.detect_keypoints(img,rects=boxes)ExampleGPU supportYou can leverage your gpu's power by enabling it like this.Face Detectiondetector.detect_face(img, show=True, enable_gpu=True)Object Detectiondetector.detect_objects(img, enable_gpu=True)Gender Detectiondetector.detect_gender(img, enable_gpu=True)Loading videos from YouTubeIf you want load videos from YouTube, you can use theload_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 videoDocumentationComplete Documentation can be found onhttps://ashwinvin.github.io/Visionlib/For example check the examples directoryNone of the images in the this repository are owned by me.
They belong to there respective owners.