Spaces:
Sleeping
Sleeping
huyingfan
commited on
Commit
•
2a534ec
1
Parent(s):
21bd41f
add more models
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ import logging
|
|
14 |
from mmengine.logging.logger import MMFormatter
|
15 |
from mmcls import list_models as list_models_
|
16 |
from mmcls.apis.model import ModelHub, init_model
|
|
|
17 |
|
18 |
|
19 |
@st.cache()
|
@@ -39,6 +40,7 @@ def list_models(*args, **kwargs):
|
|
39 |
DATA_ROOT = '.'
|
40 |
ANNO_FILE = 'meta/val.txt'
|
41 |
LOG_FILE = 'demo.log'
|
|
|
42 |
|
43 |
|
44 |
def get_model(model_name, pretrained=True):
|
@@ -65,7 +67,7 @@ def get_model(model_name, pretrained=True):
|
|
65 |
cfg.model = new_model_cfg
|
66 |
|
67 |
# prepare prototype
|
68 |
-
cached_path = f'
|
69 |
cfg.model.prototype = cached_path
|
70 |
|
71 |
model = init_model(metainfo.config, None, device='cpu')
|
@@ -130,7 +132,9 @@ def get_pred(name, img):
|
|
130 |
def app():
|
131 |
prepare_data()
|
132 |
|
133 |
-
model_name = st.sidebar.selectbox(
|
|
|
|
|
134 |
|
135 |
st.markdown(
|
136 |
"<h1>Image To Image Retrieval</h1>",
|
|
|
14 |
from mmengine.logging.logger import MMFormatter
|
15 |
from mmcls import list_models as list_models_
|
16 |
from mmcls.apis.model import ModelHub, init_model
|
17 |
+
import os
|
18 |
|
19 |
|
20 |
@st.cache()
|
|
|
40 |
DATA_ROOT = '.'
|
41 |
ANNO_FILE = 'meta/val.txt'
|
42 |
LOG_FILE = 'demo.log'
|
43 |
+
CACHED_PATH = 'cache'
|
44 |
|
45 |
|
46 |
def get_model(model_name, pretrained=True):
|
|
|
67 |
cfg.model = new_model_cfg
|
68 |
|
69 |
# prepare prototype
|
70 |
+
cached_path = f'{CACHED_PATH}/{model_name}_prototype.pt' # noqa
|
71 |
cfg.model.prototype = cached_path
|
72 |
|
73 |
model = init_model(metainfo.config, None, device='cpu')
|
|
|
132 |
def app():
|
133 |
prepare_data()
|
134 |
|
135 |
+
model_name = st.sidebar.selectbox(
|
136 |
+
"Model:",
|
137 |
+
[m.split('_prototype.pt')[0] for m in os.listdir(CACHED_PATH)])
|
138 |
|
139 |
st.markdown(
|
140 |
"<h1>Image To Image Retrieval</h1>",
|
cache/beit-base_3rdparty_in1k_prototype.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:903c5cd62888b25e31918b365e5e0141019ab21e497b6390b7a90e295e0ddf5f
|
3 |
+
size 8998649
|
cache/beitv2-base_3rdparty_in1k_prototype.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3363d51bba86a042b3a09d84fd644aa3ac2ba7df911fa2c26581ef3844440fe
|
3 |
+
size 8998649
|
cache/convnext-base_32xb128_in1k_prototype.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d9a26d889f5690cc07e52c78ef390411e95d7d794c4d236f37b43682359802b
|
3 |
+
size 11997945
|
cache/mobilenet-v3-large_3rdparty_in1k_prototype.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:54e4098c4c03b509e207bebe775233e39af697f27236158e5d1145ded7434dd3
|
3 |
+
size 11248121
|