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 ANN-Iterative-Fallback technique (ANN-Itr-FB).
Perform Approximate Nearest Neighbor (ANN) search using the HNSW index with Post-Subquery Filtering (PSF).
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 120
protected array
performVectorSearch(vector $featureVector, int[] $trees, string $model)
Perform vector search using the ANN-Iterative-Fallback technique (ANN-Itr-FB).
The search process first attempts to retrieve (top K) results using an Approximate Nearest Neighbor (ANN) search via the HNSW index. If the ANN search returns no results, the iterative index scan is triggered and the ANN search is performed again as a fallback with K = 2 * K.
at line 165
protected array
performAnnSearch(Vector $featureVector, int[] $trees, string $model, int $k)
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 190
protected ImageAnnotationLabelFeatureVector|VideoAnnotationLabelFeatureVector>
getFeatureVectorModelFor(Annotation $annotation)
Get the correct model class for the annotation type.