class GenerateAnnotationCandidateFeatureVectors extends GenerateAnnotationFeatureVectors

Traits

SerializesModels
Queueable
Dispatchable

Constants

INSERT_CHUNK_SIZE

Number of feature vector models to insert in one chunk.

Properties

protected bool $deleteWhenMissingModels

Ignore this job if the MAIA job does not exist any more.

from  GenerateAnnotationFeatureVectors

Methods

array
getAnnotationBoundingBox(array $points, Shape $shape, int $pointPadding = 112, int $boxPadding = 0, int $minSize = 32)

Get the bounding box of an annotation

array
ensureBoxAspectRatio(array $box, int $aspectWidth, int $aspectHeight)

Modify a bounding box so it adheres to the aspect ratio given by width and height.

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.

array
getPointBoundingBox(array $points, int $padding)

Get the bounding box of a point annotation.

array
getCircleBoundingBox(array $points)

Get the bounding box of a circle annotation.

array
getPolygonBoundingBox(array $points)

Get the bounding box of an annotation that is no point, circle or whole frame.

array
makeBoxIntegers(array $box)

Round and cast box values to int.

array
generateInput(array $files, array $paths, Collection $annotations)

Generate the input for the python script.

array
generateFileInput(VolumeFile $file, Collection $annotations)

No description

python(string $inputPath, string $outputPath)

Run the Python command.

readOutputCsv(string $path)

Generator to read the output CSV row by row.

__construct(MaiaJob $job)

Create a new isntance.

void
handle()

Handle the job.

Collection
getAnnotations()

Get the training proposals or annotation candidates of the job.

void
insertFeatureVectorModelChunk(array $chunk)

Insert a chunk of new feature vector models.

Details

array getAnnotationBoundingBox(array $points, Shape $shape, int $pointPadding = 112, int $boxPadding = 0, int $minSize = 32)

Get the bounding box of an annotation

Parameters

array $points
Shape $shape
int $pointPadding

The default is half the patch size of 224 that is expected by DINO.

int $boxPadding
int $minSize

Each side of the box should have at least this number of pixels. Must be divisible by 2.

Return Value

array

array ensureBoxAspectRatio(array $box, int $aspectWidth, int $aspectHeight)

Modify a bounding box so it adheres to the aspect ratio given by width and height.

Parameters

array $box
int $aspectWidth
int $aspectHeight

Return Value

array

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.

Parameters

array $box
int|null $maxWidth
int|null $maxHeight

protected array getPointBoundingBox(array $points, int $padding)

Get the bounding box of a point annotation.

Parameters

array $points
int $padding

Return Value

array

protected array getCircleBoundingBox(array $points)

Get the bounding box of a circle annotation.

Parameters

array $points

Return Value

array

protected array getPolygonBoundingBox(array $points)

Get the bounding box of an annotation that is no point, circle or whole frame.

Parameters

array $points

Return Value

array

protected array makeBoxIntegers(array $box)

Round and cast box values to int.

Parameters

array $box

Return Value

array

protected array generateInput(array $files, array $paths, Collection $annotations)

Generate the input for the python script.

Parameters

array $files

VolumeFile instances of the files to which the annotations belong.

array $paths

Paths of locally cached files.

Collection $annotations

Annotations grouped by their file ID (e.g. image_id).

Return Value

array

protected array generateFileInput(VolumeFile $file, Collection $annotations)

No description

Parameters

VolumeFile $file
Collection $annotations

Return Value

array

protected python(string $inputPath, string $outputPath)

Run the Python command.

Parameters

string $inputPath
string $outputPath

protected Generator readOutputCsv(string $path)

Generator to read the output CSV row by row.

Parameters

string $path

Return Value

Generator

__construct(MaiaJob $job)

Create a new isntance.

Parameters

MaiaJob $job

void handle()

Handle the job.

Return Value

void

at line 14
protected Collection getAnnotations()

Get the training proposals or annotation candidates of the job.

Return Value

Collection

at line 22
protected void insertFeatureVectorModelChunk(array $chunk)

Insert a chunk of new feature vector models.

Parameters

array $chunk

Return Value

void