Skip to main content

Face recognize, Object tracking, OCR

Project description

HawkEye

A library for Computer Vision, flexible and easy to use. The library uses a lot of models like ArcFace, RetinaFace, FaceLandmark, OCRModels .... These models will be downloaded automatically when used for the first time, please make sure your network connection is not blocked to google drive.

Install

HawkEye is available on pypi.org, if you just want to use it for your project, install it using pip. Requires python>=3.8, torch>=1.8

pip install hawkeye-v2

Methods

Supported methods:

1. Face Recognition

1.1 Face detection

Retina Face: Single-stage Dense Face Localisation in the Wild

import cv2
from hawkeye.face import RetinaFace

retina = RetinaFace(model_name='retina_s')

img = cv2.imread('path/to/image.png')
bboxes, kpss = retina.detect(img)
for box in bboxes:
    box = box[:4].astype(int)
    cv2.rectangle(img, (box[0],box[1]), (box[2],box[3]), (0,255,0),thickness=2)
cv2.imshow('image', img)
cv2.waitKey(0)

1.2 Face extract feature use ArcFace

ArcFace: Additive Angular Margin Loss for Deep Face Recognition

import cv2
from hawkeye.face import RetinaFace
from hawkeye.face import ArcFace

arc = ArcFace(model_name='arcface_s')
retina = RetinaFace(model_name='retina_s')

img = cv2.imread('path/to/image.png')
bboxes, kpss = retina.detect(img)
for box,kps in zip(bboxes, kpss):
    emb = arc.get(img, kps)
    print(emb)

1.3 Get similar

Coming soon

1.4 Get face landmarks, face angles

import cv2
from hawkeye.face import RetinaFace, Landmark

retina = RetinaFace(model_name='retina_s')
landmark = Landmark()

img = cv2.imread('path/to/image.png')
bboxes, kpss = retina.detect(img)
for box,kps in zip(bboxes, kpss):
    land = landmark.get(img, box)
    angle = landmark.get_face_angle(img, land)
    print(angle)

2. Tracking

import cv2
from hawkeye.face import RetinaFace
from hawkeye.tracking import BYTETracker

bt = BYTETracker()
retina = RetinaFace(model_name='retina_s')

cap = cv2.videoCapture(0)
ret, _ = cap.read()
while ret:
    ret, frame = cap.read()
    boxes,_ = retina.detect(frame)
    boxes, ids = bt.predict(frame, boxes)
    print(ids)

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

hawkeye_v2-1.0.5.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

hawkeye_v2-1.0.5-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file hawkeye_v2-1.0.5.tar.gz.

File metadata

  • Download URL: hawkeye_v2-1.0.5.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for hawkeye_v2-1.0.5.tar.gz
Algorithm Hash digest
SHA256 3151f15a51534395421216e33575283aaffe9c0f9f1381d2af307edf367c3170
MD5 385f83d38392d94e457dee4135d8a31d
BLAKE2b-256 73f75abca4b8e823a0224db5488a0cf453dbd6c70ef4effa30523674cea1e60c

See more details on using hashes here.

File details

Details for the file hawkeye_v2-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: hawkeye_v2-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for hawkeye_v2-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4334e2deda6ddce6a1053ae46efd335332caf22ce453fbf4ef018ba20bcb8fc1
MD5 2f3b1aa4193d549c96d15da053048794
BLAKE2b-256 0a2e2f3e5a77ee2a826d7009bfc57b992a74fab11e21c642404359fff01a85d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page