Skip to content

Implements Confidence filtering for Largo - #1237

Closed
dlangenk wants to merge 1 commit into
masterfrom
LargoConfFilter
Closed

dlangenk wants to merge 1 commit into
masterfrom
LargoConfFilter

Conversation

@dlangenk

@dlangenk dlangenk commented Jul 23, 2025 •

Copy link
Copy Markdown
Member

Allows to filter annotations in largo by confidence as proposed in #1166.

@mzur mzur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Video annotation labels currently have no confidence attribute at all.

More comments below.

Comment on lines -40 to 49
$this->validate($request, [
'take' => 'integer',
'shape_id' => 'array',
'shape_id.*' => 'integer',
'user_id' => 'array',
'user_id.*' => 'integer',
'union' => 'boolean',
$this->validate($request, [
'session_id' => 'filled|exists:annotation_sessions,id',
'shape_id' => 'filled|array',
'shape_id.*' => 'exists:shapes,id',
'user_id' => 'filled|array',
'user_id.*' => 'exists:users,id',
'confidence' => 'filled|array',
'confidence.*' => 'in:0,1,2,3,4',
]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please fix the indentation
  • Why was take and union removed?
  • Why is session_id added? It makes no sense in the project controller.
  • Why is confidence an array? Shouldn't be a scalar threshold?

Comment on lines +74 to +96
if ($union) {
$query->where(function ($q) use ($confidenceValues) {
foreach ($confidenceValues as $value) {
if ($value < 0) {
$q->orWhereRaw($this->getConfidenceQuery(abs($value)));
} else {
$q->orWhereRaw($this->getConfidenceQuery($value));
}
}
});
} else {
foreach ($confidenceValues as $value) {
if ($value < 0) {
$query->whereRaw($this->getConfidenceQuery(abs($value)));
} else {
$query->whereRaw($this->getConfidenceQuery($value));
}
}
}

// Remove confidence from filters array to avoid double processing
unset($filters['confidence']);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be added to compileFilterConditions() instead.

Comment on lines +41 to +48
$this->validate($request, [
'session_id' => 'filled|exists:annotation_sessions,id',
'shape_id' => 'filled|array',
'shape_id.*' => 'exists:shapes,id',
'user_id' => 'filled|array',
'user_id.*' => 'exists:users,id',
'confidence' => 'filled|array',
'confidence.*' => 'in:0,1,2,3,4',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same than above. This breaks the whole filtering mechanism.

Same in the files below.

Comment on lines +73 to +95
if ($union) {
$query->where(function ($q) use ($confidenceValues) {
foreach ($confidenceValues as $value) {
if ($value < 0) {
$q->orWhereRaw($this->getConfidenceQuery(abs($value)));
} else {
$q->orWhereRaw($this->getConfidenceQuery($value));
}
}
});
} else {
foreach ($confidenceValues as $value) {
if ($value < 0) {
$query->whereRaw($this->getConfidenceQuery(abs($value)));
} else {
$query->whereRaw($this->getConfidenceQuery($value));
}
}
}

// Remove confidence from filters array to avoid double processing
unset($filters['confidence']);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same than above. Same in the files below.

@mzur mzur Nov 27, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Comment on lines +112 to 120
User: {},
Confidence: {
0: 'Very low (0 - 0.25)',
1: 'Low (0.25 - 0.5)',
2: 'Medium (0.5 - 0.75)',
3: 'High (0.75 - 0.9)',
4: 'Very high (0.9 - 1.0)'
}
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a chance to add > and < operators to filter conditions. Instead of fixed intervals, users can enter one rule >0.25 and another <0.5 to get the same thing.

@dlangenk

dlangenk commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

I would close this one, as this might be out of scope since we likely mainly focus on manual annotations in Biigle for now. @mzur Are you ok with this, or should I revisit this one?

@mzur

mzur commented Oct 7, 2026

Copy link
Copy Markdown
Member

Feel free to close. The confidence is in limbo since forever with neither a strong opinion for or against it. I think it will become useful when we implement the AI annotation flag and then we can come back to this filter. You should add the idea to the top comment in #1166 so we don't forget about it.

@dlangenk dlangenk closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants