Skip to content

Conversation

@baulch-m
Copy link

@baulch-m baulch-m commented Nov 3, 2025

Author

Marcus Baulch s4744546

Summary

This pull request introduces a semantic segmentation of HipMRI images using an improved U-Net architecture. The model segments anatomical structures into 6 distinct classes and achieves a Dice coefficient of 0.8777 on the test set, exceeding the minimum requirement of 0.75.

Objectives

  • Implement improved U-Net architecture for prostate image segmentation
  • Achieve >0.75 Dice coefficient on HipMRI dataset
  • Support multi-class (6 classes) segmentation of prostate structure
  • Provide training, evaluation, and visualisation capabilities

Key Features

Architecture Improvements

  • Residual Connections: Added ResNet-style skip connections within encoder/decoder blocks for improved gradient flow
  • Batch Normalisation: Stabilises training and improves convergence
  • Multi-Scale Feature Extraction: 5-level encoder-decoder with skip connections

Training Enhancements

  • Combined Loss Function: 60% Dice Loss + 40% Cross-Entropy
    • Dice Loss directly optimises the evaluation metric
    • Cross-Entropy provides stable pixel-wise gradients
  • Data Augmentation: Random flips and rotations (15 degrees) applied during training

Dataset

  • HipMRI Study Open Dataset: 12,660 2D MRI slices
  • 6-Class Segmentation: Background, body outline, bone, bladder, rectum, prostate
  • Pre-split Data: 90% train / 5% validation / 5% test

Results

Performance Metrics

Metric Value
Test Dice Score 0.8777
Validation Dice 0.8654
Minimum Required 0.7500
Training Time ~10-15 min (A100 GPU)

Key Achievements

  • Exceeds requirement by 17% (0.8777 vs 0.75 required)
  • Consistent performance across train/val/test splits
  • Stable training with combined loss function
  • Robust to data augmentation

Implementation

Files Added

Core Implementation

  • modules.py - Residual U-Net architecture with ResidualBlock and UNet classes
  • dataset.py - DataSegmenter class with augmentation support
  • train.py - Training pipeline with DiceLoss and ModelTrainer
  • predict.py - Evaluation script with multi-class Dice computation and visualisation generator
  • README.md - Thorough documentation of model and outputs

Dependencies

torch>=1.9.0
torchvision>=0.10.0
numpy>=1.19.0
nibabel>=3.2.0
matplotlib>=3.3.0
tqdm>=4.60.0
scipy>=1.5.0

…dice loss class, and added constants to train.py
@wangzhaomxy
Copy link
Collaborator

<This is an initial inspection, no action is required at this point.>

File Organizing:

  • Please restore the original files in the root folder "/PatternAnalysis-2025/recognition/" and "/PatternAnalysis-2025/", all custom files must be put in the "/PatternAnalysis-2025/recognition/your_project_name_and_SID/" folder. Please make these corrections; otherwise, the merge request will be rejected.

Problem Solving:

  • The algorithm solves the problem appropriately.
  • Accuracy in testing dataset (Dice): 0.87. Meet the requirements.

Model and functions:

  • It correctly uses PyTorch to construct the improved UNet 2D models and functions.
  • NO data augmentation.
  • Properly use the train/validation/test datasets.

Code design: Good.

Code comment and docstring:

  • Good code comments
  • Good function docstrings
  • NO header block

Difficulty: Normal.

Additional Comments:

  • Good commits.
  • Great ReadMe design and comprehensive report content. However, as a report, discussion and conclusion section is expected to properly summarize your project.
  • Good work. Well done!

@gayanku
Copy link
Collaborator

gayanku commented Nov 24, 2025

Marking

Good/OK/Fair Practice (Design/Commenting, TF/Torch Usage)
Good design and implementation.
Spacing and comments.
No Header blocks. -1
Recognition Problem
Good solution to problem.
Driver Script present.
File structure present.
Good Usage & Demo & Visualisation & Data usage.
Module present.
Commenting present.
No Data leakage found.
Difficulty : Normal. Normal. ImprovedUnet2D-5
Commit Log
Good Meaningful commit messages.
Good Progressive commits.
Documentation
Readme :Good.
Model/technical explanation :Good.
Description and Comments :Good.
Markdown used and PDF submitted.
Pull Request
Successful Pull Request (Working Algorithm Delivered on Time in Correct Branch).
Feedback action require: Feedback marks possible +2 if the requested changes are made. Fix stucture for merge.-2
Request Description is good.
TOTAL-8

Marked as per the due date and changes after which aren't necessarily allowed to contribute to grade for fairness.
Subject to approval from Shakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants