Spaces:
Sleeping
Sleeping
Michael Rey
commited on
Commit
·
9a18613
1
Parent(s):
6f49636
modified code
Browse files- src/resnet_model.py +1 -2
- src/streamlit_app.py +10 -10
src/resnet_model.py
CHANGED
@@ -7,8 +7,7 @@ class MonkeyResNet(nn.Module):
|
|
7 |
super(MonkeyResNet, self).__init__()
|
8 |
|
9 |
# Load pretrained ResNet18 model from torchvision
|
10 |
-
self.model = models.resnet18(pretrained=
|
11 |
-
|
12 |
# Replace the final fully connected layer to match number of classes
|
13 |
in_features = self.model.fc.in_features
|
14 |
self.model.fc = nn.Linear(in_features, num_classes)
|
|
|
7 |
super(MonkeyResNet, self).__init__()
|
8 |
|
9 |
# Load pretrained ResNet18 model from torchvision
|
10 |
+
self.model = models.resnet18(pretrained=False)
|
|
|
11 |
# Replace the final fully connected layer to match number of classes
|
12 |
in_features = self.model.fc.in_features
|
13 |
self.model.fc = nn.Linear(in_features, num_classes)
|
src/streamlit_app.py
CHANGED
@@ -18,16 +18,16 @@ st.set_page_config(page_title="ApexID: Monkey Species Classifier", layout="wide"
|
|
18 |
MODEL_PATH = "monkey_resnet.pth"
|
19 |
CLASS_NAMES = ['n0', 'n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9']
|
20 |
LABEL_MAP = {
|
21 |
-
'n0': '
|
22 |
-
'n1': '
|
23 |
-
'n2': '
|
24 |
-
'n3': '
|
25 |
-
'n4': '
|
26 |
-
'n5': '
|
27 |
-
'n6': '
|
28 |
-
'n7': '
|
29 |
-
'n8': '
|
30 |
-
'n9': '
|
31 |
}
|
32 |
|
33 |
# Load model with caching to avoid reloading every time
|
|
|
18 |
MODEL_PATH = "monkey_resnet.pth"
|
19 |
CLASS_NAMES = ['n0', 'n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9']
|
20 |
LABEL_MAP = {
|
21 |
+
'n0': 'Alouatta Palliata',
|
22 |
+
'n1': 'Erythrocebus Patas',
|
23 |
+
'n2': 'Cacajao Calvus',
|
24 |
+
'n3': 'Macaca Fuscata',
|
25 |
+
'n4': 'Cebuella Pygmea',
|
26 |
+
'n5': 'Cebus Capucinus',
|
27 |
+
'n6': 'Mico Argentatus',
|
28 |
+
'n7': 'Saimiri Sciureus',
|
29 |
+
'n8': 'Aotus Nigriceps',
|
30 |
+
'n9': 'Trachypithecus Johnii'
|
31 |
}
|
32 |
|
33 |
# Load model with caching to avoid reloading every time
|