joonmyung 1.5.8__tar.gz → 1.5.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {joonmyung-1.5.8 → joonmyung-1.5.10}/PKG-INFO +1 -1
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/analysis.py +8 -13
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/dataset.py +2 -2
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/script.py +1 -1
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung.egg-info/PKG-INFO +1 -1
- {joonmyung-1.5.8 → joonmyung-1.5.10}/setup.py +1 -1
- {joonmyung-1.5.8 → joonmyung-1.5.10}/LICENSE.txt +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/README.md +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/hook.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/metric.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/model.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/analysis/utils.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/app.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/data.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/draw.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/dummy.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/file.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/gradcam.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/log.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/meta_data/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/meta_data/label.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/meta_data/utils.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/metric.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/models/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/models/tome.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/status.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung/utils.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung.egg-info/SOURCES.txt +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung.egg-info/dependency_links.txt +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung.egg-info/not-zip-safe +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/joonmyung.egg-info/top_level.txt +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/SA/MHSA.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/SA/PVTSA.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/SA/TMSA.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/SA/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/deit.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/evit.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/modules/PE.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/modules/__init__.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/modules/blocks.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/pvt.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/pvt_v2.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/models/tome.py +0 -0
- {joonmyung-1.5.8 → joonmyung-1.5.10}/setup.cfg +0 -0
|
@@ -14,17 +14,12 @@ import cv2
|
|
|
14
14
|
|
|
15
15
|
def anaModel(transformer_class):
|
|
16
16
|
class VisionTransformer(transformer_class):
|
|
17
|
-
def has_parameter(self, parameter_name):
|
|
18
|
-
return parameter_name in self.__init__.__code__.co_varnames
|
|
19
|
-
|
|
20
17
|
def forward_features(self, x):
|
|
21
18
|
x = self.patch_embed(x)
|
|
22
|
-
if self
|
|
19
|
+
if hasattr(self, "cls_token"):
|
|
23
20
|
cls_token = self.cls_token.expand(x.shape[0], -1, -1) # stole cls_tokens impl from Phil Wang, thanks
|
|
24
21
|
x = torch.cat((cls_token, x), dim=1)
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
23
|
if self.analysis[0] == 1: # PATCH
|
|
29
24
|
x = x # (8, 197, 192)
|
|
30
25
|
elif self.analysis[0] == 2: # POS
|
|
@@ -39,27 +34,27 @@ def anaModel(transformer_class):
|
|
|
39
34
|
|
|
40
35
|
x = self.blocks(x)
|
|
41
36
|
x = self.norm(x)
|
|
42
|
-
if self
|
|
37
|
+
if hasattr(self, "cls_token") and hasattr(self, "cls_token"):
|
|
43
38
|
return x[:, 0], x[:, 1]
|
|
44
|
-
elif self
|
|
39
|
+
elif hasattr(self, "cls_token"):
|
|
45
40
|
return self.pre_logits(x[:, 0])
|
|
46
41
|
else:
|
|
47
42
|
return self.pre_logits(x.mean(dim=1))
|
|
48
43
|
|
|
49
|
-
|
|
50
44
|
return VisionTransformer
|
|
51
45
|
|
|
52
46
|
class Analysis:
|
|
53
47
|
def __init__(self, model, analysis = [0], activate = [True, False, False, False], detach=True, key_name=None, num_classes = 1000
|
|
54
|
-
, cls_start=0, cls_end=1, patch_start=1, patch_end=None
|
|
48
|
+
, cls_start=0, cls_end=1, patch_start=1, patch_end=None, wrapping=False
|
|
55
49
|
, amp_autocast=suppress, device="cuda"):
|
|
56
50
|
# Section A. Model
|
|
57
51
|
self.num_classes = num_classes
|
|
58
52
|
self.key_name = key_name
|
|
53
|
+
if wrapping:
|
|
54
|
+
model_ = anaModel(model.__class__)
|
|
55
|
+
model.__class__ = model_
|
|
56
|
+
model.analysis = analysis
|
|
59
57
|
|
|
60
|
-
model_ = anaModel(model.__class__)
|
|
61
|
-
model.__class__ = model_
|
|
62
|
-
model.analysis = analysis
|
|
63
58
|
self.model = model
|
|
64
59
|
self.detach = detach
|
|
65
60
|
|
|
@@ -66,7 +66,7 @@ class JDataset():
|
|
|
66
66
|
sample = default_loader(img_path)
|
|
67
67
|
sample = self.transform[self.transform_type](sample)
|
|
68
68
|
|
|
69
|
-
return sample[None].to(self.device), torch.tensor(label_num).to(self.device), self.label_name[label_num]
|
|
69
|
+
return sample[None].to(self.device), torch.tensor(label_num).to(self.device), self.label_name[int(label_num)]
|
|
70
70
|
|
|
71
71
|
def getItems(self, indexs):
|
|
72
72
|
ds, ls, lns = [], [], []
|
|
@@ -126,7 +126,7 @@ class JDataset():
|
|
|
126
126
|
if __name__ == "__main__":
|
|
127
127
|
root_path = "/hub_data1/joonmyung/data/imagenet"
|
|
128
128
|
dataset = "imagenet"
|
|
129
|
-
dataset = JDataset(root_path, dataset, train=
|
|
129
|
+
dataset = JDataset(root_path, dataset, train=False)
|
|
130
130
|
d, l, l_n = dataset[[10, 3]]
|
|
131
131
|
# samples = dataset.getitems([[0,1], [0,2], [0,3]])
|
|
132
132
|
print(1)
|
|
@@ -97,7 +97,7 @@ class GPU_Worker():
|
|
|
97
97
|
return
|
|
98
98
|
|
|
99
99
|
def message(self, text):
|
|
100
|
-
url = "https://hooks.slack.com/services/TK76B38LV/
|
|
100
|
+
url = "https://hooks.slack.com/services/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"
|
|
101
101
|
payload = {"text": text}
|
|
102
102
|
headers = {'Content-type': 'application/json'}
|
|
103
103
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|