File size: 561 Bytes
7a6cb13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import json
import logging

import numpy as np
from retinaface import RetinaFace


def default_converter(o):
    if isinstance(o, np.integer):
        return int(o)
    if isinstance(o, np.floating):
        return float(o)
    if isinstance(o, np.ndarray):
        return o.tolist()
    return str(o)


# 配置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

resp = RetinaFace.detect_faces("~/Downloads/chounan.jpeg")

logger.info(
    "search results: " + json.dumps(resp, ensure_ascii=False, default=default_converter)
)