<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx" -->

---
title: How to Train a Tumor Segmentation Model on Ultrasound...
description: A data-first tutorial for training a tumor segmentation model on breast ultrasound images using MONAI and PyTorch. The workflow starts with dataset profiling...
canonical: https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Train a Tumor Segmentation Model on Ultrasound Data with MONAI | daily.dev
og:description: A data-first tutorial for training a tumor segmentation model on breast ultrasound images using MONAI and PyTorch. The workflow starts with dataset profiling...
og:url: https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx
og:image: https://api.daily.dev/og/posts/th77mRKJX.png
og:image:alt: How to Train a Tumor Segmentation Model on Ultrasound Data with MONAI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Train a Tumor Segmentation Model on Ultrasound Data with MONAI

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · 14 min read · 2 upvotes · 0 comments

## Summary

A data-first tutorial for training a tumor segmentation model on breast ultrasound images using MONAI and PyTorch. The workflow starts with dataset profiling (class imbalance ~10:1, variable resolutions, patient-grouped folds) and uses those findings to drive every pipeline decision: DiceCELoss to handle class imbalance, patient-grouped cross-validation splits to prevent leakage, bilinear/nearest-neighbor resizing, and a 2D U-Net with 1.6M parameters. The model achieves a validation Dice of 0.866 and a held-out test Dice of 0.864. Failure mode analysis reveals fragmented predictions and shadow-confusion cases, leading to a KeepLargestConnectedComponent post-processing step and suggestions for future experiments.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai>

## Similar posts on daily.dev

- [Why Your Deep Learning Model Isn't Learning: Diagnosing Data Problems in Medical Imaging](https://daily.dev/posts/why-your-deep-learning-model-isn-t-learning-diagnosing-data-problems-in-medical-imaging-7dddn59n5) · freeCodeCamp · 29 upvotes · 1 comments
- [Medium](https://daily.dev/posts/medium-bsu2jkucp) · Medium · 0 upvotes · 0 comments
- [TumorLensB0 — AI-Powered Brain MRI Tumor Classification](https://daily.dev/posts/tumorlensb0-ai-powered-brain-mri-tumor-classification-gdixh8mbm) · Medium · 0 upvotes · 0 comments
- [Adaptive Ultrasound Imaging with Physics-Informed NV-Raw2Insights-US AI](https://daily.dev/posts/adaptive-ultrasound-imaging-with-physics-informed-nv-raw2insights-us-ai-e3xwbjiil) · Hugging Face · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#deep-learning](https://daily.dev/tags/deep-learning)

[View this post on daily.dev](https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Train a Tumor Segmentation Model on Ultrasound Data with MONAI","url":"https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx"},"datePublished":"2026-07-22T21:31:21.578Z","dateModified":"2026-07-22T21:31:42.608Z","description":"A data-first tutorial for training a tumor segmentation model on breast ultrasound images using MONAI and PyTorch. The workflow starts with dataset profiling...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/355d9c39c5c3e0961cad26e7b74a3bec?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/355d9c39c5c3e0961cad26e7b74a3bec?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"freeCodeCamp","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1628412854/logos/freecodecamp","url":"https://daily.dev/sources/freecodecamp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-train-a-tumor-segmentation-model-on-ultrasound-data-with-monai-th77mrkjx","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,deep-learning","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"How to Train a Tumor Segmentation Model on Ultrasound Data with MONAI"}]}
```

