Skip to content

Update README.md #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,33 @@ python -m keras_segmentation train \

Choose model_name from the table above

### Save and load the model
To save model , the checkpoint path will auto save model , but in case got error about .h5 extention you can modify the train.py line 184 from .{epoch:05d} to .weights.h5
and checkpoint path to include file name ex: checkpoints_path = "checkpoint_dir/filename"
then to load the model again later :
```shell
from keras_segmentation.pretrained import model_from_checkpoint_path

model_config = {

"input_height": <number>,
"input_width": <number>,
"n_classes": <number>,
"model_class": "vgg_unet",

}

model = model_from_checkpoint_path(model_config, "checkpoint/t.weights.h5")

resimg = model.predict_segmentation("target_dataset/big_images/big_1.jpg")
#resimg = model.predict_segmentation("farm/farm.jpg")

# Display the segmented image
plt.imshow(resimg)
plt.axis('off') # Turn off axis
plt.show()

```


### Getting the predictions
Expand Down