Gent (PG/R - Comp Sci & Elec Eng) commited on
Commit
d062429
β€’
1 Parent(s): 72c21ec
Files changed (6) hide show
  1. .gitignore +1 -0
  2. README.md +20 -2
  3. app.py +37 -0
  4. data/20k_tree.csv +0 -0
  5. data/benchmark.csv +0 -0
  6. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .vscode
README.md CHANGED
@@ -4,10 +4,28 @@ emoji: πŸ“‰
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.7.1
8
  app_file: app.py
9
  pinned: false
10
  license: cc
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 3.24.1
8
  app_file: app.py
9
  pinned: false
10
  license: cc
11
  ---
12
 
13
+
14
+ This is a visual program of demonstrating the [SMLB](). It helps you to compare the performance of different models on each synset.
15
+
16
+ ## How to use
17
+
18
+ 1. first, you need to find the related synsets of your task. For example, if you want to know the performance on the Pets dataset which consists of cats and dogs, you can search the synsets related to cats and dogs. In this case, you can search `cat` and `dog` in the search bar. Then you will get the synsets of cats and dogs. Here, you will get `cat.n.01` and `dog.n.01`.
19
+ 2. Then you can select the synsets you want to compare. In this case, you can select `cat.n.01` and `dog.n.01`.
20
+
21
+
22
+ ## Citation
23
+ ```bibtex
24
+
25
+ @misc{wu2023smlb,
26
+ title={Beyond Accuracy: Statistical Measures and Benchmark for Evaluation of Representation from Self-Supervised Learning },
27
+ author={Jiantao Wu and Shentong Mo and Sara Atito and Josef Kittler and Zhenhua Feng and Muhammad Awais},
28
+ year={2023}
29
+ primaryClass={cs.CV}
30
+ }
31
+ ```
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from nltk.corpus import wordnet as wn
4
+ import nltk
5
+ nltk.download()
6
+
7
+ df_tree = pd.read_csv("data/20k_tree.csv")
8
+ df_metrics = pd.read_csv("data/benchmark.csv")
9
+
10
+ def query_interface(model, synset):
11
+ if model == "*":
12
+ return df_metrics.query(f"synset =='{synset}'")
13
+ else:
14
+ return df_metrics.query(f"synset =='{synset}' and model == '{model}'")
15
+
16
+ def find_synsets(lemma):
17
+ synsets = wn.synsets(lemma)
18
+ valid_set = set(df_metrics.synset.values)
19
+ synset_names = [s.name() for s in synsets if s.name() in valid_set]
20
+ return df_tree.query(f"synset in @synset_names", engine='python')
21
+
22
+ with gr.Blocks() as app:
23
+ gr.Label("WordNet Explorer", style="h1")
24
+ lemma = gr.Textbox(label="find synsets")
25
+ gr.Button("Search").click(find_synsets, lemma, outputs=[gr.DataFrame()])
26
+
27
+ gr.Label("Benchmark Explorer", style="h1")
28
+ model_list = list(set(df_metrics.model.values.tolist()))
29
+ gr.TextArea(f"This is a simple interface to query the benchmark results. You can use * as a wildcard for the model name. The available models are {", ".join(model_list)}.", lines=2)
30
+ with gr.Row():
31
+ # model = gr.inputs.Dropdown(label="model",choices=list(set(df_metrics.model.values.tolist())))
32
+ model = gr.Textbox(label="model")
33
+ synset = gr.inputs.Textbox(label="synset")
34
+ btn = gr.Button("Query", label="query")
35
+ btn.click(query_interface, inputs=[model, synset], outputs=[gr.DataFrame()])
36
+
37
+ app.launch()
data/20k_tree.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/benchmark.csv ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ pandas
2
+ nltk