Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

retinaface detection

#pip3 install opencv-python
import cv2 
from retinaface import RetinaFace

# init with normal accuracy option
detector = RetinaFace(quality="normal")

# same with cv2.imread,cv2.cvtColor 
rgb_image = detector.read("data/hian.jpg")

faces = detector.predict(rgb_image)
# faces is list of face dictionary
# each face dictionary contains x1 y1 x2 y2 left_eye right_eye nose left_lip right_lip
# faces=[{"x1":20,"y1":32, ... }, ...]

result_img = detector.draw(rgb_image,faces)

# save ([...,::-1] : rgb -> bgr )
cv2.imwrite("data/result_img.jpg",result_img[...,::-1])

# show using cv2
# cv2.imshow("result",result_img[...,::-1)
# cv2.waitKey()
Comment

PREVIOUS NEXT
Code Example
Python :: How to obtain a jpeg resolution in python 
Python :: pass dictionary to random forest regressor 
Python :: Python how to use __sub__ 
Python :: Python __ge__ magic method 
Python :: Exception has occurred: FileNotFoundError 
Python :: NumPy trim_zeros Syntax 
Python :: function nbYear(p0, percent, aug, p) { let n = 0; while(p0 < p) { p0 = p0 + Math.round(p0 * (percent/100)) + aug; n ++; } return n; } 
Python :: 16. count total numbers of uppercase and lowercase characters in input string python 
Python :: import date formater 
Python :: NumPy packbits Syntax 
Python :: django view - mixins and GenericAPIView (retrieve, update or delete - GET, PUT, DELETE) 
Python :: qt list widget let editable 
Python :: jenkins crumb python request 
Python :: penggunaan fromkeys di python 
Python :: call a Python range() using range(stop) 
Python :: how can I edit the history in python shell 
Python :: How to Export Sql Server Result to Excel in Python 
Python :: map reduce and filter functions in python 
Python :: how to make a yes or no question in python 
Python :: gitlab ci deploy key 
Python :: Flask select which form to POST by button click 
Python :: win10 python com ports 
Python :: python json string indices must be integersAdd Answer 
Python :: ring Loop Command 
Python :: text to ascii art generator python 
Python :: notebook prevent cell output 
Python :: how to create dataframe from rdd 
Python :: how to know google index of a page using python 
Python :: python dictionary get ket 
Python :: python class overwrite length method 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =