Face recognize, Object tracking, OCR
Project description
Hawk-eyes
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
Hawk-eyes 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
- onnxruntime==1.7 (or onnxruntime-gpu)
pip install hawk-eyes
Methods
Supported methods:
1. Face Recognition
1.1 Face detection
Retina Face: Single-stage Dense Face Localisation in the Wild
import cv2
from hawk_eyes.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 hawk_eyes.face import RetinaFace
from hawk_eyes.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 hawk_eyes.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 hawk_eyes.face import RetinaFace
from hawk_eyes.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
Built Distribution
File details
Details for the file hawk_eyes-2.1.2.tar.gz
.
File metadata
- Download URL: hawk_eyes-2.1.2.tar.gz
- Upload date:
- Size: 103.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7675a77c1c43b64f5279fa44b03275bf6c6ed643e636c8b0f04e5fdfe8308012 |
|
MD5 | 18e892e6328df1b726adf9403ab47bc8 |
|
BLAKE2b-256 | 922e54f2b5bda7d208991dff670157f27e6a7d5456867136094537f83de1f3d0 |
File details
Details for the file hawk_eyes-2.1.2-py3-none-any.whl
.
File metadata
- Download URL: hawk_eyes-2.1.2-py3-none-any.whl
- Upload date:
- Size: 119.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f152fef4f4c242508d64fedd58752759f773b01975e75f7291b72598df3ed9c6 |
|
MD5 | 6a1706206b5266720dc14f8b7ddd6eca |
|
BLAKE2b-256 | 51ab7ba5899373f7b5f8a9e474bd7c846c9406f3a7d1ae69cc18283bfca157c4 |