- This is a 2D version of MEDCNN and without attentions in the decoder
- Full paper with attentions: https://doi.org/10.1109/ICASSP49660.2025.10890832
Install TFDWT from PyPI (Option
pip install MEDCNNInstall TFDWT from Github (Option
Download the package
git clone https://github.com/kkt-ee/MEDCNN.gitChange directory to the downloaded MEDCNN
cd MEDCNNRun the following command to install the TFDWT package
pip install .import MEDCNN
MEDCNN.__version__pip install TFDWT==0.0.2Important: Make sure TFDWT version 0.0.2 is installed. The newer version 0.0.3 is not compatible!!
- Import MEDCNN 2D Gφψ without attention
from MEDCNN.models.G2DwithoutAttention import Gφψ, configs- Import the control Unet2D model for reference
from MEDCNN.models.ControlUnet2D import Unet2D, uconfigs- Import utils to compile and train model
from MEDCNN.utils.utils import elapsedtime, timestamp
from MEDCNN.utils.BoundaryAwareDiceLoss import BoundaryAwareDiceLoss
from MEDCNN.utils.Load2Ddata import load_ibsr_XY
from MEDCNN.utils.TTViterators import get_train_test_val_iterators
from MEDCNN.utils.dice import dice_coef
from MEDCNN.utils.compile1 import compile_model
from MEDCNN.utils.Train1 import train- Example: Compile a MEDCNN
CONFIGKEY= 'minimal2'
model, segconfig = Gφψ(config=configs[CONFIGKEY], compile=False), 'nonResidual'
model, lossname = compile_model(model, dataset, dice_coef)- Example: Compile a control Unet2D
CONFIGKEY = '45678',
model, segconfig = Unet2D(config=uconfigs['45678'], compile=False), 'nonResidual'
model, lossname = compile_model(model, dataset, dice_coef)- Example: Train a model with X an Y of shape (7056, 256, 256, 1), (7056, 256, 256, 1)
train_iterator, test_iterator, val_iterator = get_train_test_val_iterators(X,Y) #Assuming X and Y is loaded by a dataloader
train(
model,
train_iterator, test_iterator, val_iterator,
dataset='IBSR',
segconfig=segconfig,
lossname='bce',
CONFIGKEY=CONFIGKEY,
epochs=40)pip uninstall MEDCNNMEDCNN (C) 2025 Kishore Kumar Tarafdar, भारत 🇮🇳