Loader Class
Loads image data.
- Inheritance
-
nimbusml.internal.core.feature_extraction.image._loader.LoaderLoadernimbusml.base_transform.BaseTransformLoadersklearn.base.TransformerMixinLoader
Constructor
Loader(image_folder=None, columns=None, **params)
Parameters
Name | Description |
---|---|
columns
|
a dictionary of key-value pairs, where key is the output column name and value is the input column name.
simply specify The << operator can be used to set this value (see Column Operator) For example
For more details see Columns. |
image_folder
|
Folder where to search for images. |
params
|
Additional arguments sent to compute engine. |
Examples
###############################################################################
# Loader
# Resizer
# PixelExtractor
# DnnFeaturizer
# FastLinearBinaryClassifier
import numpy as np
import pandas
from nimbusml import Pipeline
from nimbusml.datasets.image import get_RevolutionAnalyticslogo, get_Microsoftlogo
from nimbusml.feature_extraction.image import Loader, Resizer, PixelExtractor
from nimbusml.linear_model import FastLinearBinaryClassifier
data = pandas.DataFrame(data=dict(
Path=[get_RevolutionAnalyticslogo(), get_Microsoftlogo()],
Label=[True, False]))
X = data[['Path']]
y = data[['Label']]
# define the training pipeline
pipeline = Pipeline([
Loader(columns={'ImgPath': 'Path'}),
Resizer(image_width=32, image_height=32,
columns={'ImgResize': 'ImgPath'}),
PixelExtractor(columns={'ImgPixels': 'ImgResize'}),
FastLinearBinaryClassifier(feature='ImgPixels')
])
# train
pipeline.fit(X, y)
# predict
scores = pipeline.predict(X)
print("Predicted Labels:", scores.PredictedLabel.values)
# Predicted Labels : [True False]
print("Accuracy:", np.mean(y.Label.values == scores.PredictedLabel.values))
# Accuracy : 1
Remarks
Loader
loads images from paths.
Methods
get_params |
Get the parameters for this operator. |
get_params
Get the parameters for this operator.
get_params(deep=False)
Parameters
Name | Description |
---|---|
deep
|
Default value: False
|