ImageAnnotationController
class ImageAnnotationController extends Controller
Traits
Methods
Determines if the request was done by an automated script (with API token or ajax).
Redirects to the _redirect URL, to a route or else back.
Shows a list of all annotations of the specified image.
Displays the annotation.
Updates the annotation including its points.
Removes the annotation.
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 exact KNN search using the B-Tree index for filtering.
Drop the HNSW index if exists. This step is necessary to perform exact KNN search because the planner almost always prioritize the HNSW index to perform vector search.
Details
in
Controller at line 21
bool
isAutomatedRequest(Request $request = null)
Determines if the request was done by an automated script (with API token or ajax).
in
Controller at line 15
protected RedirectResponse
fuzzyRedirect()
Redirects to the _redirect URL, to a route or else back.
at line 74
StreamedJsonResponse
index(Request $request, int $id)
Shows a list of all annotations of the specified image.
at line 145
ImageAnnotation
show(int $id)
Displays the annotation.
at line 217
ImageAnnotation
store(StoreImageAnnotation $request)
Creates a new annotation in the specified image.
at line 337
update(Request $request, int $id)
Updates the annotation including its points.
at line 383
Response
destroy(int $id)
Removes the annotation.
at line 401
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 437
protected array
performVectorSearch(vector $featureVector, int[] $trees, int[] $topNLabels)
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 463
protected array
performAnnSearch(Vector $featureVector, int[] $trees)
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 496
protected array
performKnnSearch(Vector $featureVector, int[] $trees)
Perform exact KNN search using the B-Tree index for filtering.
This search filters the data based on label_tree_id using the B-Tree index, and then performs the vector search to find the nearest neighbors of the input feature vector. This method is used as a fallback when the ANN search does not return results.
at line 526
protected
dropHNSWIndex()
Drop the HNSW index if exists. This step is necessary to perform exact KNN search because the planner almost always prioritize the HNSW index to perform vector search.