Mehmet Batuhan Duman commited on
Commit
67b8498
1 Parent(s): ea1daab

Changed scan func

Browse files
Files changed (2) hide show
  1. .idea/workspace.xml +1 -1
  2. app.py +13 -17
.idea/workspace.xml CHANGED
@@ -65,7 +65,7 @@
65
  <workItem from="1683665300392" duration="7649000" />
66
  <workItem from="1683708398011" duration="1235000" />
67
  <workItem from="1684437905081" duration="110000" />
68
- <workItem from="1686602174110" duration="7569000" />
69
  </task>
70
  <servers />
71
  </component>
 
65
  <workItem from="1683665300392" duration="7649000" />
66
  <workItem from="1683708398011" duration="1235000" />
67
  <workItem from="1684437905081" duration="110000" />
68
+ <workItem from="1686602174110" duration="7930000" />
69
  </task>
70
  <servers />
71
  </component>
app.py CHANGED
@@ -70,57 +70,53 @@ class Net2(nn.Module):
70
  class Net(nn.Module):
71
  def __init__(self):
72
  super(Net, self).__init__()
73
- self.conv1 = nn.Conv2d(3, 512, 3, padding=1)
74
- self.bn1 = nn.BatchNorm2d(512)
75
  self.pool1 = nn.MaxPool2d(2, 2)
76
  self.dropout1 = nn.Dropout(0.25)
77
 
78
- self.conv2 = nn.Conv2d(512, 256, 3, padding=1)
79
- self.bn2 = nn.BatchNorm2d(256)
80
  self.pool2 = nn.MaxPool2d(2, 2)
81
  self.dropout2 = nn.Dropout(0.25)
82
 
83
- self.conv3 = nn.Conv2d(256, 128, 3, padding=1)
84
- self.bn3 = nn.BatchNorm2d(128)
85
  self.pool3 = nn.MaxPool2d(2, 2)
86
  self.dropout3 = nn.Dropout(0.25)
87
 
88
- self.conv4 = nn.Conv2d(128, 64, 3, padding=1)
89
- self.bn4 = nn.BatchNorm2d(64)
90
  self.pool4 = nn.MaxPool2d(2, 2)
91
- self.dropout4 = nn.Dropout(0.20)
92
 
93
  self.flatten = nn.Flatten()
94
 
95
- self.fc1 = nn.Linear(1600, 300)
96
- self.fc2 = nn.Linear(300, 150)
97
  self.fc3 = nn.Linear(150, 2)
98
 
99
  def forward(self, x):
100
- x = F.relu(self.bn1(self.conv1(x)))
101
  x = self.pool1(x)
102
  x = self.dropout1(x)
103
 
104
- x = F.relu(self.bn2(self.conv2(x)))
105
  x = self.pool2(x)
106
  x = self.dropout2(x)
107
 
108
- x = F.relu(self.bn3(self.conv3(x)))
109
  x = self.pool3(x)
110
  x = self.dropout3(x)
111
 
112
- x = F.relu(self.bn4(self.conv4(x)))
113
  x = self.pool4(x)
114
  x = self.dropout4(x)
115
 
116
  x = self.flatten(x)
117
  x = F.relu(self.fc1(x))
118
  x = F.relu(self.fc2(x))
119
- x = F.softmax(self.fc3(x), dim=1)
120
  return x
121
 
122
  model = None
123
- model_path = "models1.pth"
124
 
125
  model2 = None
126
  model2_path = "model4.pth"
 
70
  class Net(nn.Module):
71
  def __init__(self):
72
  super(Net, self).__init__()
73
+ self.conv1 = nn.Conv2d(3, 32, 3, padding=1)
 
74
  self.pool1 = nn.MaxPool2d(2, 2)
75
  self.dropout1 = nn.Dropout(0.25)
76
 
77
+ self.conv2 = nn.Conv2d(32, 32, 3, padding=1)
 
78
  self.pool2 = nn.MaxPool2d(2, 2)
79
  self.dropout2 = nn.Dropout(0.25)
80
 
81
+ self.conv3 = nn.Conv2d(32, 32, 3, padding=1)
 
82
  self.pool3 = nn.MaxPool2d(2, 2)
83
  self.dropout3 = nn.Dropout(0.25)
84
 
85
+ self.conv4 = nn.Conv2d(32, 32, 3, padding=1)
 
86
  self.pool4 = nn.MaxPool2d(2, 2)
87
+ self.dropout4 = nn.Dropout(0.25)
88
 
89
  self.flatten = nn.Flatten()
90
 
91
+ self.fc1 = nn.Linear(32 * 5 * 5, 200)
92
+ self.fc2 = nn.Linear(200, 150)
93
  self.fc3 = nn.Linear(150, 2)
94
 
95
  def forward(self, x):
96
+ x = F.relu(self.conv1(x))
97
  x = self.pool1(x)
98
  x = self.dropout1(x)
99
 
100
+ x = F.relu(self.conv2(x))
101
  x = self.pool2(x)
102
  x = self.dropout2(x)
103
 
104
+ x = F.relu(self.conv3(x))
105
  x = self.pool3(x)
106
  x = self.dropout3(x)
107
 
108
+ x = F.relu(self.conv4(x))
109
  x = self.pool4(x)
110
  x = self.dropout4(x)
111
 
112
  x = self.flatten(x)
113
  x = F.relu(self.fc1(x))
114
  x = F.relu(self.fc2(x))
115
+ x = torch.sigmoid(self.fc3(x))
116
  return x
117
 
118
  model = None
119
+ model_path = "model3.pth"
120
 
121
  model2 = None
122
  model2_path = "model4.pth"