Class: PatchExtractor
Extracts patches from a collection of images.
Read more in the User Guide.
Constructors
new PatchExtractor()
new PatchExtractor(
opts
?):PatchExtractor
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.max_patches ? | number | The 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 ? | any | The 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 ? | number | Determines 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
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/feature_extraction/image/PatchExtractor.ts:21 |
_isInitialized | boolean | false | generated/feature_extraction/image/PatchExtractor.ts:20 |
_py | PythonBridge | undefined | generated/feature_extraction/image/PatchExtractor.ts:19 |
id | string | undefined | generated/feature_extraction/image/PatchExtractor.ts:16 |
opts | any | undefined | generated/feature_extraction/image/PatchExtractor.ts:17 |
Accessors
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
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 ? | any | Not 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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Additional fit parameters. |
opts.X ? | ArrayLike [] | Input samples. |
opts.y ? | ArrayLike | Target 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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A 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
Parameter | Type |
---|---|
py | PythonBridge |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
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