Documentation
Classes
PatchExtractor

PatchExtractor

Extracts patches from a collection of images.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new PatchExtractor(opts?: object): PatchExtractor;

Parameters

NameTypeDescription
opts?object-
opts.max_patches?numberThe maximum number of patches per image to extract. If max\_patches is a float in (0, 1), it is taken to mean a proportion of the total number of patches.
opts.patch_size?anyThe dimensions of one patch.
opts.random_state?numberDetermines the random number generator used for random sampling when max\_patches is not None. Use an int to make the randomness deterministic. See Glossary.

Returns

PatchExtractor

Defined in: generated/feature_extraction/image/PatchExtractor.ts:23 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/feature_extraction/image/PatchExtractor.ts:21 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/feature_extraction/image/PatchExtractor.ts:20 (opens in a new tab)

_py

PythonBridge

Defined in: generated/feature_extraction/image/PatchExtractor.ts:19 (opens in a new tab)

id

string

Defined in: generated/feature_extraction/image/PatchExtractor.ts:16 (opens in a new tab)

opts

any

Defined in: generated/feature_extraction/image/PatchExtractor.ts:17 (opens in a new tab)

Accessors

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/feature_extraction/image/PatchExtractor.ts:43 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/feature_extraction/image/PatchExtractor.ts:47 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/feature_extraction/image/PatchExtractor.ts:98 (opens in a new tab)

fit()

Do nothing and return the estimator unchanged.

This method is just there to implement the usual API and hence work in pipelines.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Training data.
opts.y?anyNot used, present for API consistency by convention.

Returns

Promise<any>

Defined in: generated/feature_extraction/image/PatchExtractor.ts:117 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/feature_extraction/image/PatchExtractor.ts:56 (opens in a new tab)

transform()

Transform the image samples in X into a matrix of patch data.

Signature

transform(opts: object): Promise<any[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[][]Array of images from which to extract patches. For color images, the last dimension specifies the channel: a RGB image would have n\_channels=3.

Returns

Promise<any[]>

Defined in: generated/feature_extraction/image/PatchExtractor.ts:155 (opens in a new tab)