Skip to content

Compatibility with TensorFlow 2.4.1 #380

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 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions keras_segmentation/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@


def model_from_checkpoint_path(checkpoints_path):

from .models.all_models import model_from_name
assert (os.path.isfile(checkpoints_path+"_config.json")
), "Checkpoint not found."
assert (os.path.isfile(os.path.join(checkpoints_path, "_config.json"))), "Checkpoint not found."
model_config = json.loads(
open(checkpoints_path+"_config.json", "r").read())
latest_weights = find_latest_checkpoint(checkpoints_path)
Expand Down
5 changes: 3 additions & 2 deletions keras_segmentation/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
import six
from keras.callbacks import Callback
from keras.callbacks import ModelCheckpoint
import tensorflow as tf
import glob
import sys


def find_latest_checkpoint(checkpoints_path, fail_safe=True):

# This is legacy code, there should always be a "checkpoint" file in your directory

def get_epoch_number_from_path(path):
return path.replace(checkpoints_path, "").strip(".")
return os.path.basename(path).replace(".index", "").strip(".")

# Get all matching files
all_checkpoint_files = glob.glob(checkpoints_path + ".*")
Expand All @@ -41,6 +41,7 @@ def get_epoch_number_from_path(path):

return latest_epoch_checkpoint


def masked_categorical_crossentropy(gt, pr):
from keras.losses import categorical_crossentropy
mask = 1 - gt[:, :, 0]
Expand Down