LabelBotService
class LabelBotService
Methods
Get the suggested labels of a new annotation either by using a label_id or a feature_vector from the request.
No description
Get all label trees that are used by all projects which are visible to the user.
Perform vector search using the Dynamic Index Switching (DIS) technique.
Perform Approximate Nearest Neighbor (ANN) search using the HNSW index with Post-Subquery Filtering (PSF).
Perform Approximate Nearest Neighbor (ANN) search using the HNSW iterative index scan.
Get the correct model class for the annotation type.
Details
at line 27
array
getLabelsForAnnotation(Annotation $annotation, int $volumeId, Request $request)
Get the suggested labels of a new annotation either by using a label_id or a feature_vector from the request.
at line 64
protected
enforceRateLimit($user)
No description
at line 85
protected array
getLabelTreeIds(mixed $user, int $volumeId)
Get all label trees that are used by all projects which are visible to the user.
at line 121
protected array
performVectorSearch(vector $featureVector, int[] $trees, string $model)
Perform vector search using the Dynamic Index Switching (DIS) technique.
The search process first attempts to retrieve results using an Approximate Nearest Neighbor (ANN) search via the HNSW index. If the ANN search returns no results, it falls back to an exact KNN search using the B-Tree index for filtering, ensuring that results are always returned.
at line 146
protected array
performAnnSearch(Vector $featureVector, int[] $trees, $model)
Perform Approximate Nearest Neighbor (ANN) search using the HNSW index with Post-Subquery Filtering (PSF).
The search uses the HNSW index to find the top K nearest neighbors of the input feature vector, and then applies filtering based on the label_tree_id values. If no results are found or if the filtering removes all results, an empty array is returned.
at line 183
protected array
performAnnSearchWithIterativeIndexScan(Vector $featureVector, int[] $trees, $model)
Perform Approximate Nearest Neighbor (ANN) search using the HNSW iterative index scan.
The search uses the HNSW iterative index scan to find the top K nearest neighbors of the input feature vector, and then applies filtering based on the label_tree_id values. If the filtering removes all results, the iterative scan will automatically scan more of the index until enough results are found (or it reaches hnsw.max_scan_tuples, which is 20,000 by default), finally if no results are found, an empty array is returned.
at line 220
protected ImageAnnotationLabelFeatureVector|VideoAnnotationLabelFeatureVector>
getFeatureVectorModelFor(Annotation $annotation)
Get the correct model class for the annotation type.