Created
August 14, 2022 17:59
-
-
Save maziyarpanahi/ae3bf2aca5f0e68435daaf80472f4f5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sparknlp.annotator import * | |
from sparknlp.base import * | |
from pyspark.ml import Pipeline | |
imageAssembler = ImageAssembler() \ | |
.setInputCol("image") \ | |
.setOutputCol("image_assembler") | |
imageClassifier = ViTForImageClassification \ | |
.pretrained("image_classifier_vit_base_patch16_224") \ | |
.setInputCols("image_assembler") \ | |
.setOutputCol("class") \ | |
.setBatchSize(8) | |
pipeline = Pipeline(stages=[ | |
imageAssembler, | |
imageClassifier | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment