feat: Retrain Attention ResUNet segmentation model and resolve dimension mismatch#93
Open
Nicks-19 wants to merge 2 commits into
Open
feat: Retrain Attention ResUNet segmentation model and resolve dimension mismatch#93Nicks-19 wants to merge 2 commits into
Nicks-19 wants to merge 2 commits into
Conversation
Owner
|
@Nicks-19 add issue no in pr description |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This Pull Request updates the 162-layer Attention ResUNet brain tumor segmentation model. It uses a dataset and it fixes some problems, with the Flask backend. This fixes issue #74.
Key Modifications
app.py)The code now looks for
ResUNet-weights.kerasfirst when it loads the segmentation model. If it does not find this it will useweights_seg.hdf5instead.This fixes a problem where the wrong number of layers were loaded. This caused an error that said
ValueError: Layer count mismatch....utilities.py)The code now makes sure that
y_trueandy_predare the type when it calculates the loss and metrics. This prevents aTypeErrorfrom happening when the code is run.This is because Keras 3 and TensorFlow 2.x need
float32but the code was giving themint64.train_segmentation.py. ResUNet-model.json`)There is a Python script that can train the ResUNet model on its own. It builds the model trains it and saves the weights.
The script can train both the 90-layer simple ResUNet and the 162-layer Attention ResUNet.
The
ResUNet-model.jsonfile has been updated to make sure everything is consistent..gitignore)The
.gitignorefile now tells Git to ignore*.kerasand*.h5files. These are the weight files that we do not want to commit to GitHub.Verification and Metrics
1. Flask App Initialization
Verified that the backend starts up and loads all ensemble and segmentation models successfully without any dimensions mismatch: