LinB203 commited on
Commit
3fb43f7
·
1 Parent(s): c60e216
.idea/Video-Bench.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Python 3.8 (videomae)" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/deployment.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
4
+ <serverData>
5
+ <paths name="[email protected]:36000 password">
6
+ <serverdata>
7
+ <mappings>
8
+ <mapping local="$PROJECT_DIR$" web="/" />
9
+ </mappings>
10
+ </serverdata>
11
+ </paths>
12
+ <paths name="[email protected]:36000 password (1)">
13
+ <serverdata>
14
+ <mappings>
15
+ <mapping local="$PROJECT_DIR$" web="/" />
16
+ </mappings>
17
+ </serverdata>
18
+ </paths>
19
+ <paths name="[email protected]:22 password">
20
+ <serverdata>
21
+ <mappings>
22
+ <mapping local="$PROJECT_DIR$" web="/" />
23
+ </mappings>
24
+ </serverdata>
25
+ </paths>
26
+ <paths name="[email protected]:22 password (1)">
27
+ <serverdata>
28
+ <mappings>
29
+ <mapping local="$PROJECT_DIR$" web="/" />
30
+ </mappings>
31
+ </serverdata>
32
+ </paths>
33
+ </serverData>
34
+ </component>
35
+ </project>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (videomae)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/Video-Bench.iml" filepath="$PROJECT_DIR$/.idea/Video-Bench.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
.idea/workspace.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="5983f0f5-7cc8-4a1b-b6b8-29b6de24d9b1" name="Changes" comment="" />
5
+ <option name="SHOW_DIALOG" value="false" />
6
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
8
+ <option name="LAST_RESOLUTION" value="IGNORE" />
9
+ </component>
10
+ <component name="FileTemplateManagerImpl">
11
+ <option name="RECENT_TEMPLATES">
12
+ <list>
13
+ <option value="Python Script" />
14
+ </list>
15
+ </option>
16
+ </component>
17
+ <component name="Git.Settings">
18
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
19
+ </component>
20
+ <component name="MarkdownSettingsMigration">
21
+ <option name="stateVersion" value="1" />
22
+ </component>
23
+ <component name="ProjectId" id="2YvCPBFCmJYfrrZhilKxOxZjgWB" />
24
+ <component name="ProjectViewState">
25
+ <option name="hideEmptyMiddlePackages" value="true" />
26
+ <option name="showLibraryContents" value="true" />
27
+ </component>
28
+ <component name="PropertiesComponent"><![CDATA[{
29
+ "keyToString": {
30
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
31
+ "RunOnceActivity.ShowReadmeOnStart": "true",
32
+ "WebServerToolWindowFactoryState": "true",
33
+ "last_opened_file_path": "D:/up_hf_space/Video-Bench/file",
34
+ "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
35
+ }
36
+ }]]></component>
37
+ <component name="RecentsManager">
38
+ <key name="CopyFile.RECENT_KEYS">
39
+ <recent name="D:\up_hf_space\Video-Bench\file" />
40
+ </key>
41
+ </component>
42
+ <component name="RunManager">
43
+ <configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
44
+ <module name="Video-Bench" />
45
+ <option name="INTERPRETER_OPTIONS" value="" />
46
+ <option name="PARENT_ENVS" value="true" />
47
+ <envs>
48
+ <env name="PYTHONUNBUFFERED" value="1" />
49
+ </envs>
50
+ <option name="SDK_HOME" value="" />
51
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
52
+ <option name="IS_MODULE_SDK" value="true" />
53
+ <option name="ADD_CONTENT_ROOTS" value="true" />
54
+ <option name="ADD_SOURCE_ROOTS" value="true" />
55
+ <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
56
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/app.py" />
57
+ <option name="PARAMETERS" value="" />
58
+ <option name="SHOW_COMMAND_LINE" value="false" />
59
+ <option name="EMULATE_TERMINAL" value="false" />
60
+ <option name="MODULE_MODE" value="false" />
61
+ <option name="REDIRECT_INPUT" value="false" />
62
+ <option name="INPUT_FILE" value="" />
63
+ <method v="2" />
64
+ </configuration>
65
+ <recent_temporary>
66
+ <list>
67
+ <item itemvalue="Python.app" />
68
+ </list>
69
+ </recent_temporary>
70
+ </component>
71
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
72
+ <component name="TaskManager">
73
+ <task active="true" id="Default" summary="Default task">
74
+ <changelist id="5983f0f5-7cc8-4a1b-b6b8-29b6de24d9b1" name="Changes" comment="" />
75
+ <created>1701396639759</created>
76
+ <option name="number" value="Default" />
77
+ <option name="presentableId" value="Default" />
78
+ <updated>1701396639759</updated>
79
+ <workItem from="1701396641392" duration="695000" />
80
+ </task>
81
+ <servers />
82
+ </component>
83
+ <component name="TypeScriptGeneratedFilesManager">
84
+ <option name="version" value="3" />
85
+ </component>
86
+ <component name="com.intellij.coverage.CoverageDataManagerImpl">
87
+ <SUITE FILE_PATH="coverage/Video_Bench$app.coverage" NAME="app Coverage Results" MODIFIED="1701397312132" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
88
+ </component>
89
+ </project>
__pycache__/constants.cpython-38.pyc ADDED
Binary file (3.92 kB). View file
 
app.py CHANGED
@@ -9,6 +9,7 @@ import tempfile
9
 
10
  from constants import *
11
  from src.auto_leaderboard.model_metadata_type import ModelType
 
12
 
13
  global data_component, filter_component
14
 
@@ -26,7 +27,8 @@ def add_new_eval(
26
  if input_file is None:
27
  return "Error! Empty file!"
28
  else:
29
- input_data = input_file.decode("utf-8").split('\n')[1].split(',')
 
30
  input_data = [float(i) for i in input_data]
31
 
32
  csv_data = pd.read_csv(CSV_DIR)
 
9
 
10
  from constants import *
11
  from src.auto_leaderboard.model_metadata_type import ModelType
12
+ from src.compute import compute_scores
13
 
14
  global data_component, filter_component
15
 
 
27
  if input_file is None:
28
  return "Error! Empty file!"
29
  else:
30
+ input_file = compute_scores(input_file)
31
+ input_data = input_file[1]
32
  input_data = [float(i) for i in input_data]
33
 
34
  csv_data = pd.read_csv(CSV_DIR)
file/ANSWER.json ADDED
The diff for this file is too large to render. See raw diff
 
file/Video-Bench-Input.json ADDED
The diff for this file is too large to render. See raw diff
 
file/result.csv CHANGED
@@ -7,4 +7,5 @@ Random,28.45459441,25.84861538,24.47045673,35.04471112,0.3458,0.26224,0.265,0.22
7
  [Valley-7B](https://github.com/RupertLuo/Valley),33.95521521,28.38772829,29.20933333,44.268584,0.381,0.32032,0.2802802,0.3141,0.2905,0.203448,0.111108278,0.237,0.32587,0.31341,0.41666,0.5653846,0.333
8
  [mPLUG-owl-7B](https://github.com/X-PLUG/mPLUG-Owl),33.14659856,33.16526701,26.39762867,39.8769,0.41470735,0.4245,0.363,0.31656,0.2705,0.2275862,0.277777611,0.2395,0.3017,0.25072886,0.333333,0.510256,0.32
9
  [Video-LLaMA-7B](https://github.com/DAMO-NLP-SG/Video-LLaMA),32.83174044,32.48401966,27.79906667,38.212135,0.3985,0.4115,0.3405,0.312766,0.289,0.275862,0.166666556,0.2475,0.324082,0.26239,0.30555555,0.4910256,0.3115
10
- [Chat-UniVi-7B](https://github.com/PKU-YuanGroup/Chat-UniVi),35.31147004,37.87,27.43,40.64,0.49,0.486,0.4165,0.413,0.29,0.2827,0.166666649,0.2305,0.3357,0.2566,0.3889,0.5308,0.2907
 
 
7
  [Valley-7B](https://github.com/RupertLuo/Valley),33.95521521,28.38772829,29.20933333,44.268584,0.381,0.32032,0.2802802,0.3141,0.2905,0.203448,0.111108278,0.237,0.32587,0.31341,0.41666,0.5653846,0.333
8
  [mPLUG-owl-7B](https://github.com/X-PLUG/mPLUG-Owl),33.14659856,33.16526701,26.39762867,39.8769,0.41470735,0.4245,0.363,0.31656,0.2705,0.2275862,0.277777611,0.2395,0.3017,0.25072886,0.333333,0.510256,0.32
9
  [Video-LLaMA-7B](https://github.com/DAMO-NLP-SG/Video-LLaMA),32.83174044,32.48401966,27.79906667,38.212135,0.3985,0.4115,0.3405,0.312766,0.289,0.275862,0.166666556,0.2475,0.324082,0.26239,0.30555555,0.4910256,0.3115
10
+ [Chat-UniVi-7B](https://github.com/PKU-YuanGroup/Chat-UniVi),35.31147004,37.87,27.43,40.64,0.49,0.486,0.4165,0.413,0.29,0.2827,0.166666649,0.2305,0.3357,0.2566,0.3889,0.5308,0.2907
11
+ [1](1),35.701846153846155,32.89153846153847,32.04,42.174,37.97,35.14,37.97,35.53,31.58,27.27,16.67,34.21,31.65,30.26,33.33,53.33,35.44
file/sample_to_upload.csv DELETED
@@ -1,2 +0,0 @@
1
- Avg. All,Avg. Video-Exclusive,Avg. Prior-Knowledge QA,Avg. Decision-Making,ActivityNet,MSVD,MSRVTT,TGIF,Youcook2,Ucfcrime,MOT,TVQA,MV,NBA,Driving-exam,Driving-decision-making,SQA3D
2
- 40,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1
 
 
 
src/__pycache__/compute.cpython-38.pyc ADDED
Binary file (2.09 kB). View file
 
src/__pycache__/utils_display.cpython-38.pyc ADDED
Binary file (4.21 kB). View file
 
src/auto_leaderboard/__pycache__/model_metadata_type.cpython-38.pyc ADDED
Binary file (1.16 kB). View file
 
src/compute.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import glob
4
+ import argparse
5
+ import csv
6
+
7
+
8
+ def chatgpt_json(merge_file):
9
+ # chat results
10
+ merge_data = merge_file.decode("utf-8")
11
+ merge_data = eval(merge_data)
12
+ correct_answer_file = 'file/ANSWER.json'
13
+ with open(correct_answer_file, 'r', encoding='utf-8') as f:
14
+ correct_answer_data = json.load(f)
15
+
16
+ dataset_scores_dict = {}
17
+ for dataset_name, item in merge_data.items():
18
+
19
+ total_nums = len(item)
20
+ correct = 0
21
+ # assert len(item) >= len(correct_answer_data[dataset_name]), f'Video-Bench-Input.json---{dataset_name}---is incomplete!'
22
+ for id, sub_item in item.items():
23
+ if sub_item['output_chatgpt_choice'] == correct_answer_data[dataset_name][id]['answer']:
24
+ correct += 1
25
+
26
+ dataset_scores_dict[dataset_name] = round(correct / total_nums * 100, 2)
27
+ return dataset_scores_dict
28
+
29
+
30
+ def compute_scores(merge_file):
31
+ dataset_score_dict = chatgpt_json(merge_file)
32
+ dataset_weight = {
33
+ 1:
34
+ {
35
+ "ActivityNet": 1,
36
+ "MSVD": 1,
37
+ "MSRVTT": 1,
38
+ "TGIF": 1,
39
+ "Youcook2": 1,
40
+ "Ucfcrime": 1,
41
+ "MOT": 0.5,
42
+ },
43
+
44
+ 2:
45
+ {
46
+ "TVQA": 1,
47
+ "MV": 1,
48
+ "NBA": 1,
49
+ },
50
+
51
+ 3:
52
+ {
53
+ "Driving-exam": 0.5,
54
+ "Driving-decision-making": 1,
55
+ "SQA3D": 1,
56
+ }
57
+
58
+ }
59
+
60
+ # Video-exclusive Understanding score
61
+ exclusive_understanding_weight = dataset_weight[1]
62
+ weights_sum = sum(exclusive_understanding_weight.values())
63
+ exclusive_understanding_score = 0
64
+ # import ipdb; ipdb.set_trace()
65
+ for dataset_name, weight in exclusive_understanding_weight.items():
66
+ exclusive_understanding_score += weight * dataset_score_dict[dataset_name] / weights_sum
67
+
68
+ # Prior Knowledge-based Question-answer
69
+ prior_QA_weight = dataset_weight[2]
70
+ weights_sum = sum(prior_QA_weight.values())
71
+ prior_QA_score = 0
72
+ for dataset_name, weight in prior_QA_weight.items():
73
+ prior_QA_score += weight * dataset_score_dict[dataset_name] / weights_sum
74
+
75
+ # Comprehension and Decision-making
76
+ com_and_dec_QA_weight = dataset_weight[3]
77
+ weights_sum = sum(com_and_dec_QA_weight.values())
78
+ com_and_dec_QA_score = 0
79
+ for dataset_name, weight in com_and_dec_QA_weight.items():
80
+ com_and_dec_QA_score += weight * dataset_score_dict[dataset_name] / weights_sum
81
+
82
+ dataset_score_dict['Exclusive_understanding'] = exclusive_understanding_score
83
+ dataset_score_dict['Prior_Knowledge'] = prior_QA_score
84
+ dataset_score_dict['Comprehension_and_Decision-making'] = com_and_dec_QA_score
85
+
86
+ # final score
87
+ final_score = sum([exclusive_understanding_score, prior_QA_score, com_and_dec_QA_score]) / 3
88
+ dataset_score_dict['final_score'] = final_score
89
+
90
+ # print(dataset_score_dict)
91
+ # with open(args.score_output_file, 'w', encoding='utf-8') as f:
92
+ # json.dump(dataset_score_dict, f, indent=2)
93
+ # print(f'{args.score_output_file} is saved!')
94
+ # ========================
95
+ data = [
96
+
97
+ ["Avg. All", "Avg. Video-Exclusive", "Avg. Prior-Knowledge QA", "Avg. Decision-Making",
98
+ "ActivityNet", "MSVD", "MSRVTT", "TGIF", "Youcook2", "Ucfcrime",
99
+ "MOT", "TVQA", "MV", "NBA", "Driving-exam", "Driving-decision-making", "SQA3D"],
100
+
101
+ [final_score, exclusive_understanding_score, prior_QA_score, com_and_dec_QA_score,
102
+ dataset_score_dict['ActivityNet'],
103
+ dataset_score_dict["MSVD"],
104
+ dataset_score_dict['MSRVTT'],
105
+ dataset_score_dict['TGIF'],
106
+ dataset_score_dict['Youcook2'],
107
+ dataset_score_dict['Ucfcrime'],
108
+ dataset_score_dict['MOT'],
109
+ dataset_score_dict['TVQA'],
110
+ dataset_score_dict['MV'],
111
+ dataset_score_dict['NBA'],
112
+ dataset_score_dict['Driving-exam'],
113
+ dataset_score_dict['Driving-decision-making'],
114
+ dataset_score_dict['SQA3D'],
115
+ ],
116
+ ]
117
+
118
+ return data
119
+