exadel-inc / exadel-inc/CompreFace
Face Detection Service does not recognize biggest faces first
- Dominant language
- Java
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When submitting an image with 2 faces, when using "limit=1" the smallest of the 2 faces in the image is returned instead of the biggest face.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a detection service
2. Send a request to detect faces in image using ""http://localhost:8000/api/v1/detection/detect?limit=0
3. 2 faces are recognized, smallest face first:
```
{
"result" : [ {
"age" : {
"probability" : 1.0,
"high" : 32,
"low" : 32
},
"box" : {
"probability" : 0.999154806137085,
"x_max" : 106,
"y_max" : 482,
"x_min" : 3,
"y_min" : 337
}
}, {
"age" : {
"probability" : 1.0,
"high" : 38,
"low" : 38
},
"box" : {
"probability" : 0.9985826015472412,
"x_max" : 360,
"y_max" : 646,
"x_min" : 153,
"y_min" : 342
}
} ]
}
```
5. Send the same request using the same image but using "limit=1"
6. The smallest first face is returned instead of the second bigger face:
```
{
"result" : [ {
"age" : {
"probability" : 1.0,
"high" : 32,
"low" : 32
},
"box" : {
"probability" : 0.999154806137085,
"x_max" : 106,
"y_max" : 482,
"x_min" : 3,
"y_min" : 337
}
} ]
}
```
**Expected behavior**
When using "limit=1" on an image with 2 faces, the bigger face should be returned, not the smallest one, as described in the docs: "maximum number of faces on the image to be recognized. It recognizes the biggest faces first. Value of 0 represents no limit. Default value: 0"
**Screenshots**

**Desktop (please complete the following information):**
- OS: Windows 10
- Browser: Chrome
- Version: Latest
**Additional context**
Using Docker on Windows 10 subcenter-arcface-r100 custom build v 1.1.0
Contributor guide
Research direction
Start by reproducing the detection endpoint with the same two-face image and compare limit=0 with limit=1 in the Docker service. Trace where the detection results are ordered and limited, then compare the behavior with the documented biggest-faces-first expectation. Done means limit=1 returns the larger face while the unrestricted response still includes both faces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- api, computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100