We've got a dataset of some images(png) which loaded into the spark data-frame. It has transformed and has the following columns (image URI, label, one-hot-label)
ValueError: Cannot extract any feature from dataset!
Now, docs said only about transfer learning i.e. InceptionV3 and save it as HDFS format. The dataset is well structured for this demo though. Each row represents Image metadata. Let's look.
Using cv.fit(train) we pass whole training set to keras estimator, where parameter like inputCol pick image column (the actual image URI), and related labelCol pick one hot vector.
def imageStructToArray(imageRow):
"""
Convert an image to a numpy array.
:param imageRow: Row, must use imageSchema.
:return: ndarray, image data.
"""
imType = imageTypeByOrdinal(imageRow.mode)
shape = (imageRow.height, imageRow.width, imageRow.nChannels)
return np.ndarray(shape, imType.dtype, imageRow.data)
This is very staight forward and should work like a charm. A key catch is that, docs explains this with InceptionV3 and its trained imagenet weight where we try a custom Keras model with no weight and expect it to train in distributed manner. However, we also tried InceptionV3 and its imagenet wegiht, but no Luck.
We've got a dataset of some images(png) which loaded into the spark data-frame. It has transformed and has the following columns (image URI, label, one-hot-label)
We're trying to implement distributed hyperparameter tuning using a custom
Keras
model.KerasImageFileEstimator
Then We've used it for hyperparameter tuning by doing a grid search using
CrossValidataor
.But it throws an error:
Now, docs said only about transfer learning i.e. InceptionV3 and save it as HDFS format. The dataset is well structured for this demo though. Each row represents Image metadata. Let's look.
Using
cv.fit(train)
we pass whole training set to keras estimator, where parameter likeinputCol
pick image column (the actual image URI), and relatedlabelCol
pick one hot vector.It seems that the function of
keras_image_file_estimator
_getNumpyFeaturesAndLabels unable to catch image URI.and Feature extractor imageStructToArray seems here unable to decode.
This is very staight forward and should work like a charm. A key catch is that, docs explains this with
InceptionV3
and its trained imagenet weight where we try a customKeras
model with no weight and expect it to train in distributed manner. However, we also triedInceptionV3
and its imagenet wegiht, but no Luck.@MrBago @mateiz @ahirreddy @marmbrus @pmangg Thank You.