Skip to content

Conversation

@dlangenk
Copy link
Member

@dlangenk dlangenk commented Jul 23, 2025

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

Copy link
Member

@mzur mzur left a comment

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
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
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
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
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.

Copy link
Member

@mzur mzur Nov 27, 2025

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
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.

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.

3 participants