-
-
Save aribornstein/e2770c95b614af8ef3428cbac7f98876 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
# Load the data | |
datamodule = SemanticSegmentationData.from_folders( | |
train_folder="./train", | |
train_target_folder="./targets", | |
num_classes=21) | |
# Build the model | |
model = SemanticSegmentation( | |
backbone="torchvision/fcn_resnet50", | |
num_classes=datamodule.num_classes, | |
serializer=SegmentationLabels(visualize=True)) | |
# Create the trainer | |
trainer = flash.Trainer() | |
# Train the model | |
trainer.finetune(model, datamodule=datamodule) | |
# Make a prediction | |
model.predict(["image.png"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment