Skip to content

Conversation

@ChiaJouLu
Copy link

Project Summary

Student ID: 47222610
Project: #3 - HipMRI 2D Prostate Segmentation with Improved UNet
Difficulty: Normal

Implementation

Implemented Improved UNet architecture for automated prostate segmentation from 2D MRI images.

Key Features:

  • 5-level encoder/decoder with residual connections
  • Instance Normalization for stable training
  • Context aggregation module (dilated convolutions: 1, 2, 4, 8)
  • Deep supervision at 5 decoder levels

Files:

  • modules.py - Model architecture
  • dataset.py - Data loading
  • train.py - Training script
  • predict.py - Testing script
  • README.md - Documentation
  • Result_Images/ - Visualizations

Results

Test Performance:

Class Dice
Background 0.9881
Peripheral Zone 0.9842
Transition Zone 0.9271
Prostate 0.9552

Requirement: ≥ 0.75
Achieved: 0.9552 (27.4% above requirement)

- Use provided utility functions from assignment Appendix B
- Implement load_data_2D with Z-score normalization
- Implement to_channels for one-hot encoding
- Support large dataset: 11,460 train, 660 val, 540 test images
- Add comprehensive documentation and test script
- Verified on Rangpur with actual HipMRI data
- Implemented the standard Conv2d -> BatchNorm2d -> ReLU sequence repeated twice.
- Ensures dimensions are preserved using padding=1.
- This serves as the fundamental building unit for the later Encoder and Decoder paths.
- Integrates MaxPool2d (2x2, stride 2) for downsampling.
- After downsampling, use DoubleConv to expand channels and refine features (C -> 2C).
- Ensures data shape transformation: (N, C, H, W) -> (N, 2C, H/2, W/2).
- Implements the upsampling to double H/W dimensions of the deep features.
- Integrates the skip connection by concatenating the upsampled features with the corresponding encoder features.
- Applies DoubleConv after concatenation to fuse high-level semantics and low-level detail, while halving the number of channels.
- Implemented a 1×1 convolution layer to map final feature maps to output classes
- No activation applied; handled by loss function
- Input shape: (N, C_in, H, W)
- Output shape: (N, num_classes, H, W)
…dical image segmentation

- Implemented full encoder–decoder structure with skip connections
- Includes DoubleConv, Downsampling, Upsampling, and OutConv components
- Supports variable input/output channels (e.g. 1→4 for HipMRI prostate segmentation)
- Forward pass outputs raw logits
…tion, and new training loop

- Added 'load_data_with_resive()' and 'load_labels_with_resive()' to debug and preprocess input images and labels with resizing support.
- Updated Dice metric: replaced 'dice_coefficient' with  'dice_coefficient_per_class()' to compute Dice score separately for each class.
- Implemented 'train_one_epoch()' function for training loop structure.
- Minor refactoring and cleanup for debugging consistency.
- simplify runner output and final checkpoint; improve the entire things; keep core training logic unchanged
@ChiaJouLu
Copy link
Author

Important Update: Corrected Class Labels

I have corrected an error in the class descriptions after my initial submission.

Corrections made:

  • Class 1: "Peripheral Zone""Body"
  • Class 2: "Transition Zone""Bone"

Files updated:

  • README.md
  • train.py
  • predict.py
  • Result_Images/ (all visualizations regenerated)

Note: These are documentation corrections only. Model implementation and results remain unchanged.

Turnitin: Unable to resubmit PDF. Please review the corrected version here on GitHub.

@wangzhaomxy
Copy link
Collaborator

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

File Organizing: Well-organized files.

Problem Solving:

  • The algorithm solves the problem appropriately.
  • Accuracy in testing dataset (Dice): 0.95. 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
  • Good header block

Difficulty: Normal.

Additional Comments:

  • Good commits
  • Excellent ReadMe design and comprehensive report content. However, as a report, discussion and conclusion section is expected to properly summarize your project.
  • In fact, the HipMRI dataset contains six labels: label 3 corresponds to the bladder, and label 5 corresponds to the prostate. This does not match the description provided in your report.

@gayanku
Copy link
Collaborator

gayanku commented Nov 24, 2025

Marking

Good/OK/Fair Practice (Design/Commenting, TF/Torch Usage)
Adequate design and implementation. -1
Spacing and comments.
Header blocks.
Recognition Problem
OK solution to problem. -2
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 :Acceptable. -1
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).
No Feedback required.
Request Description is good.
TOTAL-9

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