Skip to content

OpenAI API does not support image-based person identification Description: #1

@ksparkKJE

Description

@ksparkKJE

Hello,
When using the OpenAI API (model gpt-4o) to compare two images and determine whether they show the same person, the model consistently returns uncertain or refusal responses such as "I don't know" or "I'm sorry, I can't help with identifying people in these images."

This appears to be caused by OpenAI’s current usage policy, which restricts “face recognition” or “person identification” tasks for privacy and safety reasons.
As a result, even when both images clearly show the same person, the model does not return "Yes" or "No" as expected.
Can you modify the example?

[src/images/listing2.py]

# Simplified version of the script
payload = {
    "model": "gpt-4o",
    "messages": [
        {"role": "user", "content": [
            {"type": "text", "text": "Do the images show the same person ('Yes'/'No')?"},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image1}"}},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image2}"}}
        ]}
    ],
    "max_tokens": 1
}

response = requests.post(
    "https://api.openai.com/v1/chat/completions",
    headers={"Authorization": f"Bearer {ai_key}"},
    json=payload
)
print(response.json()["choices"][0]["message"]["content"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions