diff --git a/README.md b/README.md index dc08ca6..aac4979 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ The PyTorch code resides in `backend.py` and outlines the custom `DementiaMultim ## 📜 Academic Reference & License This project is licensed under the **Apache License 2.0**. Feel free to use, modify, and distribute this codebase for academic and clinical research. +Testing Pair Extraordinaire Achievement 🚀 Working towards Pull Shark achievement 🦈 working with pull requests Testing GitHub Pull Request Achievement diff --git a/backend.py b/backend.py index 47c1ea1..8e15db1 100644 --- a/backend.py +++ b/backend.py @@ -9,7 +9,7 @@ # ========================================== # DATASETS: Where the data is loaded and used -# ========================================== + class DementiaMultimodalDataset(Dataset): """ Custom PyTorch Dataset that loads both MRI (ADNI/OASIS) @@ -28,9 +28,9 @@ def __len__(self): def __getitem__(self, idx): row = self.metadata.iloc[idx] - # 1. Load the dataset for Branch 1 (OASIS / ADNI MRI) + mri_path = os.path.join(self.mri_dir, row['mri_filename']) - # Load 2D/3D MRI slide (converting to RGB for ResNet compatibility here) + mri_image = Image.open(mri_path).convert('RGB') if self.transform: @@ -78,7 +78,7 @@ def __init__(self, tabular_input_dim=128, lstm_hidden_dim=256, num_classes=3): nn.Softmax(dim=1) ) - # --- Classification Layer --- + self.classifier = nn.Sequential( nn.Linear(fusion_dim, 256), nn.ReLU(), @@ -151,7 +151,6 @@ def forward(self, mri_imgs, speech_seq): # Assuming MFCC features have 40 coefficients per frame model = MultimodalDementiaModel(tabular_input_dim=40, lstm_hidden_dim=256, num_classes=3) - # --- 5. Evaluation / Accuracy Calculation Loop (Example) --- def calculate_accuracy(model, data_loader, device='cpu'): model.eval() correct = 0