Codewithsalty commited on
Commit
86b180a
·
verified ·
1 Parent(s): 4837923

Update TumorModel.py

Browse files
Files changed (1) hide show
  1. TumorModel.py +18 -5
TumorModel.py CHANGED
@@ -1,5 +1,6 @@
1
  import torch.nn as nn
2
 
 
3
  class TumorClassification(nn.Module):
4
  def __init__(self):
5
  super(TumorClassification, self).__init__()
@@ -16,9 +17,7 @@ class TumorClassification(nn.Module):
16
  self.pool3 = nn.MaxPool2d(2)
17
 
18
  self.flatten = nn.Flatten()
19
-
20
- # 👇 Update this line to match the saved .pth model
21
- self.fc1 = nn.Linear(86528, 512) # Fixed input size
22
  self.relu_fc = nn.ReLU()
23
  self.fc2 = nn.Linear(512, 256)
24
  self.relu_fc2 = nn.ReLU()
@@ -31,5 +30,19 @@ class TumorClassification(nn.Module):
31
  x = self.flatten(x)
32
  x = self.relu_fc(self.fc1(x))
33
  x = self.relu_fc2(self.fc2(x))
34
- x = self.output(x)
35
- return x
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import torch.nn as nn
2
 
3
+ # 🎯 Tumor Type Classification Model
4
  class TumorClassification(nn.Module):
5
  def __init__(self):
6
  super(TumorClassification, self).__init__()
 
17
  self.pool3 = nn.MaxPool2d(2)
18
 
19
  self.flatten = nn.Flatten()
20
+ self.fc1 = nn.Linear(86528, 512) # fixed to match pth
 
 
21
  self.relu_fc = nn.ReLU()
22
  self.fc2 = nn.Linear(512, 256)
23
  self.relu_fc2 = nn.ReLU()
 
30
  x = self.flatten(x)
31
  x = self.relu_fc(self.fc1(x))
32
  x = self.relu_fc2(self.fc2(x))
33
+ return self.output(x)
34
+
35
+ # 🧬 Glioma Stage Classifier Model
36
+ class GliomaStageModel(nn.Module):
37
+ def __init__(self):
38
+ super(GliomaStageModel, self).__init__()
39
+ self.model = nn.Sequential(
40
+ nn.Linear(9, 128),
41
+ nn.ReLU(),
42
+ nn.Linear(128, 64),
43
+ nn.ReLU(),
44
+ nn.Linear(64, 4)
45
+ )
46
+
47
+ def forward(self, x):
48
+ return self.model(x)