-
Notifications
You must be signed in to change notification settings - Fork 18
Implements Confidence filtering for Largo #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
mzur
left a comment
There was a problem hiding this 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.
| $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', | ||
| ]); |
There was a problem hiding this comment.
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
takeandunionremoved? - Why is
session_idadded? It makes no sense in the project controller. - Why is
confidencean array? Shouldn't be a scalar threshold?
| 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']); | ||
| } |
There was a problem hiding this comment.
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.
| $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', |
There was a problem hiding this comment.
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.
| 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']); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here?
| 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)' | ||
| } | ||
| }, |
There was a problem hiding this comment.
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.
Allows to filter annotations in largo by confidence as proposed in #1166.