人脸比对服务

基于InsightFace的人脸比对服务,用于检测两张图片中的人脸是否相同,并提供相关信息。

  • by johnbikes
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 johnbikes/mcp_srv_insight

使用说明

环境

  • uv sync

跑

比较两个url

  • uv run same_from_urls.py

带代理的服务器

  • 确保创建一个 .env 并添加您的openaiapi密钥
  • uv run main.py

从第一次运行开始,预计会是这样的

The two URLs you provided do not contain the same face according to insightface.

期望第二次运行的输出看起来像这样

The two URLs do not contain the same face.

Here is some information about the individuals in each image:

1. The first image (https://upload.wikimedia.org/wikipedia/commons/c/c1/Lionel_Messi_20180626.jpg) is of Lionel Messi. He is an Argentine professional footballer widely regarded as one of the greatest football players of all time. Messi has won numerous awards including the Ballon d'Or multiple times. He is known for his incredible dribbling skills, vision, and goal-scoring ability.

2. The second image (https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg) is of Cristiano Ronaldo. He is a Portuguese professional footballer also considered one of the greatest footballers in history. Ronaldo has won multiple Ballon d'Or awards as well. He is famous for his athleticism, goal-scoring prowess, and leadership on the field.

Both are iconic figures in the world of football and are often compared for their extraordinary talents and achievements.

根据InsightFace,使用lifepsan支持来确定之前是否见过人脸

  • 梅西对阵梅西和罗纳尔多
INFO:same_from_urls:Checking is_same for url1 = 'https://upload.wikimedia.org/wikipedia/commons/2/26/Leo_messi_barce_2005.jpg', url2 = None
INFO:__main__:Searched 1 URLs and found result = {'ids': [['id_0', 'id_1']], 'embeddings': None, 'documents': [['https://upload.wikimedia.org/wikipedia/commons/c/c1/Lionel_Messi_20180626.jpg', 'https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg']], 'uris': None, 'included': ['metadatas', 'documents', 'distances'], 'data': None, 'metadatas': [[None, None]], 'distances': [[0.47270458936691284, 1.1545511484146118]]}
INFO:mcp.server.lowlevel.server:Processing request of type ListToolsRequest
The face in the URL you provided has been seen before according to insightface. A similar face was found in this URL: https://upload.wikimedia.org/wikipedia/commons/c/c1/Lionel_Messi_20180626.jpg.
  • 内马尔对阵梅西和罗纳尔多
INFO:same_from_urls:Checking is_same for url1 = 'https://live.staticflickr.com/8778/17145642931_56ea3a6113_b.jpg', url2 = None
The face in the URL you provided has not been seen before according to insightface. If you have any other URLs or questions, feel free to ask!