InitializeFeatureVectorChunk
class InitializeFeatureVectorChunk extends GenerateFeatureVectors
Traits
Constants
| DINO_PATCH_SIZE |
Size of a square input patch for generating feature vectors with DINO. |
Methods
Get the bounding box of an annotation
Modify a bounding box so it adheres to the aspect ratio given by width and height.
Adjust the position and size of the box so it is contained in a box with the given dimensions.
Get the bounding box of a point annotation.
Get the bounding box of a circle annotation.
Get the bounding box of an annotation that is no point, circle or whole frame.
Get the byte string of the cropped and resized patch for the Python worker.
Send the PNG image crop to the Python worker and return the feature vector array.
No description
No description
Get the array to insert new feature vector models into the DB.
Generate feature vectors from the thumbnails of many annotations.
Get the vips image instance for submission to the Python worker for feature vectors.
Details
in
GenerateFeatureVectors at line 29
array
getAnnotationBoundingBox(array $points, Shape $shape, int $pointPadding = self::DINO_PATCH_SIZE / 2, int $boxPadding = 0, int $minSize = 32)
Get the bounding box of an annotation
in
GenerateFeatureVectors at line 78
array
ensureBoxAspectRatio(array $box, int $aspectWidth, int $aspectHeight)
Modify a bounding box so it adheres to the aspect ratio given by width and height.
in
GenerateFeatureVectors at line 116
makeBoxContained(array $box, int|null $maxWidth, int|null $maxHeight)
Adjust the position and size of the box so it is contained in a box with the given dimensions.
in
GenerateFeatureVectors at line 142
protected array
getPointBoundingBox(array $points, int $padding)
Get the bounding box of a point annotation.
in
GenerateFeatureVectors at line 155
protected array
getCircleBoundingBox(array $points)
Get the bounding box of a circle annotation.
in
GenerateFeatureVectors at line 168
protected array
getPolygonBoundingBox(array $points)
Get the bounding box of an annotation that is no point, circle or whole frame.
in
GenerateFeatureVectors at line 188
protected array
makeBoxIntegers(array $box)
Round and cast box values to int.
in
GenerateFeatureVectors at line 193
protected array
generateAnnotationBoxes(VolumeFile $file, Collection $annotations)
No description
in
GenerateFeatureVectors at line 219
protected string
getCropBufferForPyworker(Image $image, array $box)
Get the byte string of the cropped and resized patch for the Python worker.
in
GenerateFeatureVectors at line 230
protected array
sendPyworkerRequest(string $buffer)
Send the PNG image crop to the Python worker and return the feature vector array.
at line 22
__construct(array $imageAnnotationIds, array $videoAnnotationIds)
No description
at line 29
handle()
No description
at line 69
Collection
getInsertData(Collection $models)
Get the array to insert new feature vector models into the DB.
at line 96
Generator
getFeatureVectors(Collection $models)
Generate feature vectors from the thumbnails of many annotations.
at line 175
protected
getVipsImageForPyworker(string $buffer)
Get the vips image instance for submission to the Python worker for feature vectors.