DocumentationClassesPatchExtractor

Class: PatchExtractor

Extracts patches from a collection of images.

Read more in the User Guide.

Python Reference

Constructors

new PatchExtractor()

new PatchExtractor(opts?): PatchExtractor

Parameters

ParameterTypeDescription
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. If set to undefined, extract all possible patches.
opts.patch_size?anyThe dimensions of one patch. If set to undefined, the patch size will be automatically set to (img_height // 10, img_width // 10), where img_height and img_width are the dimensions of the input images.
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

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/feature_extraction/image/PatchExtractor.ts:21
_isInitializedbooleanfalsegenerated/feature_extraction/image/PatchExtractor.ts:20
_pyPythonBridgeundefinedgenerated/feature_extraction/image/PatchExtractor.ts:19
idstringundefinedgenerated/feature_extraction/image/PatchExtractor.ts:16
optsanyundefinedgenerated/feature_extraction/image/PatchExtractor.ts:17

Accessors

py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/feature_extraction/image/PatchExtractor.ts:43

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

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

Returns Promise<void>

Defined in generated/feature_extraction/image/PatchExtractor.ts:95


fit()

fit(opts): Promise<any>

Only validate the parameters of the estimator.

This method allows to: (i) validate the parameters of the estimator and (ii) be consistent with the scikit-learn transformer API.

Parameters

ParameterTypeDescription
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.
opts.y?anyNot used, present for API consistency by convention.

Returns Promise<any>

Defined in generated/feature_extraction/image/PatchExtractor.ts:114


fit_transform()

fit_transform(opts): Promise<any[]>

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters

ParameterTypeDescription
optsobject-
opts.fit_params?anyAdditional fit parameters.
opts.X?ArrayLike[]Input samples.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns Promise<any[]>

Defined in generated/feature_extraction/image/PatchExtractor.ts:153


get_metadata_routing()

get_metadata_routing(opts): Promise<any>

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Parameters

ParameterTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns Promise<any>

Defined in generated/feature_extraction/image/PatchExtractor.ts:197


init()

init(py): Promise<void>

Initializes the underlying Python resources.

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

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/feature_extraction/image/PatchExtractor.ts:56


set_output()

set_output(opts): Promise<any>

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters

ParameterTypeDescription
optsobject-
opts.transform?"default" | "pandas" | "polars"Configure output of transform and fit_transform.

Returns Promise<any>

Defined in generated/feature_extraction/image/PatchExtractor.ts:233


transform()

transform(opts): Promise<any[]>

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

Parameters

ParameterTypeDescription
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:265