Memuat
Memuat
Watch every step above performed live, with English narration.
0 plays
Class book
Page 1 / 6
Cover: Class U-Net Brain Tumor Segmentation #4: Loss for Segmentation: Dice, IoU & BCE-Dice, then Training U-Net Baseline
Click a page or use ◀ ▶ to turn · swipe on mobile · to enlarge
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class U-Net Brain Tumor Segmentation Loss #4: Loss for Segmentation: Dice, IoU & BCE-Dice, then Training U-Net Baseline”.
Other ways we can help with Python.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Multi-Objective Optimization Course: NSGA-II, MOPSO & Hybrid Algorithms (Python)

ECG Arrhythmia Classification Course with Wavelet & Deep Learning (PyTorch)

ANFIS + PSO/GA Course for Non-Linear Time Series Forecasting (Python)
Have it built for you
No time to learn Python? Our team can do the project for you.

Python Machine Learning — Prediction Models, Customer Segmentation, Fraud Detection & AI Apps

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
This is the final result, another UNED-BASE training curve, with LOS-BASE-E DAIS continuously decreasing and DAIS validation increasing up to around 0.76. We also understand why pixel accuracy is misleading, and why segmentation researchers use DAIS and IOU. Let's get started. Hello, welcome to episode four of the brain tumor segmentation series with the metaheuristically optimized UNED. Our UNED is now ready. Before training it, we must determine how to evaluate and penalize model errors. In medical segmentation, the choice of metrics and loss functions is very crucial, because tumor pixels only make up a small portion of the image.
Create file LOS-SEC.PE DAIS coefficient is twice the intersection between prediction and target, divided by the number of pixels of both. IOU, or Jaccard, is intersection divided by union. Both have values between 0-1, and only count tumor pixels, so the large black background does not raise the score. A small epsilon prevents division by zero.
Then the class-weighted loss. Binary cross entropy penalizes each pixel and makes training stable, while DAIS loss, which is 1 minus DAIS, directly optimizes tumor overlap. Both are combined with half-half weights. This combination is very common in medical segmentation research.
Let's test with a small example, a 4x4 tumor mask in a 10x10 image. A perfect prediction gets DAIS and IOU of 1. Prediction shifted 2 pixels down drastically becomes DAIS 0.25 and IOU 0.14. Empty prediction gets 0. But look, the pixel accuracy of the empty prediction is actually 84%. This is why accuracy should not be used for segmentation.
Now create the train underscore unit.py file. The evaluation function collects predictions for all validation data, at threshold 0.5, then calculates global DAIS and IOU.
The training function we create can be reused with learning rate parameters, number of filters F, dropout, number of IPOC, and data proportion. This function will be called repeatedly by the metaheuristic algorithm in episode 5. For each IPOC we calculate the validation DAIS, and the model with the best DAIS is saved.
The main part of training the baseline unit with general settings, learning rate 0.001, 16 filters, no dropout, 15 IPOC. Run. Validation DAIS rises quickly from 0.4 in the first IPOC, then fluctuates, this is normal because small tumors are difficult and validation data comes from different patients. The best value 0.763 is achieved at IPOC 11. The left graph shows the continuously decreasing training loss, the right graph shows the validation DAIS. These numbers become the benchmark for the optimized model.
Done. We have now understood DAIS and IOU Creating base CI DAIS loss, reusable training function, and baseline unit with DAIS validation 0.76. In the next episode, we will automatically optimize hyperparameters of the unit using Particle Swarm Optimization and Grey Wolf Optimizer. Currently working on a thesis, dissertation, or AI research in the field of medical image segmentation? Cerdas Inovasi Digital helps with deep learning implementation, from UNED segmentation, metahuristic optimization PSO and Grey Wolf, up to DAIS evaluation, IOU, and result writing, as well as offering deep learning courses with PyTor. Want to master the entire series? From MRI brain datasets to metahuristically optimized UNED? All 6 episodes, complete with step-by-step PDF guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Want just one class? Buy a single class with lifetime access. Subscribe now on the premium page cerdasinovasidigital.com Contact our WhatsApp or visit cerdasinovasidigital.com Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →