Spaces:
Running
Running
PedroMartelleto
commited on
Commit
·
e4e90a2
1
Parent(s):
681344b
human eval3
Browse files- CONTROLS_file_pairs.csv +11 -0
- app.py +31 -15
- file_pairs.csv +31 -11
- get_vimeo.py +14 -5
- results.csv +2 -2
CONTROLS_file_pairs.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
file_name,vista_id,gem_id
|
2 |
+
1,1051245161,1051244884
|
3 |
+
11,1051245233,1051244979
|
4 |
+
13,1051245253,1051245004
|
5 |
+
17,1051245269,1051245040
|
6 |
+
2,1051245188,1051244923
|
7 |
+
21,1051245289,1051245077
|
8 |
+
22,1051245311,1051245091
|
9 |
+
25,1051245334,1051245112
|
10 |
+
27,1051245352,1051245139
|
11 |
+
3,1051245204,1051244950
|
app.py
CHANGED
@@ -12,7 +12,7 @@ import pandas as pd
|
|
12 |
|
13 |
load_dotenv()
|
14 |
|
15 |
-
video_pairs = pd.read_csv('file_pairs.csv')[['file_name', 'vista_id', 'gem_id']].values.tolist()
|
16 |
random.seed(42)
|
17 |
random.shuffle(video_pairs)
|
18 |
|
@@ -45,8 +45,9 @@ def get_video_pair(state):
|
|
45 |
shuffled_pairs = state['shuffled_pairs']
|
46 |
user_votes = state['user_votes']
|
47 |
while pair_index < len(shuffled_pairs):
|
48 |
-
video_name, vista_id, gem_id = shuffled_pairs[pair_index]
|
49 |
pair_key = f"{vista_id}_{gem_id}"
|
|
|
50 |
if pair_key not in user_votes:
|
51 |
# Randomize left-right positions
|
52 |
if random.choice([True, False]):
|
@@ -125,6 +126,7 @@ def update_interface(responses, state):
|
|
125 |
gr.update(visible=False), # video_column
|
126 |
gr.update(value=""), # video1
|
127 |
gr.update(value=""), # video2
|
|
|
128 |
gr.update(visible=False), # question_column
|
129 |
gr.update(visible=False), # button_row
|
130 |
output_message, # output
|
@@ -136,12 +138,14 @@ def update_interface(responses, state):
|
|
136 |
else:
|
137 |
video1_html = generate_video_html(video1_url)
|
138 |
video2_html = generate_video_html(video2_url)
|
|
|
139 |
# Update videos and reset questions
|
140 |
return (
|
141 |
gr.update(visible=True), # video_column
|
142 |
gr.update(visible=True), # video_column
|
143 |
gr.update(value=video1_html), # video1
|
144 |
gr.update(value=video2_html), # video2
|
|
|
145 |
gr.update(visible=True), # question_column
|
146 |
gr.update(visible=True), # button_row
|
147 |
"", # output
|
@@ -172,6 +176,7 @@ def authenticate_user(email, state):
|
|
172 |
gr.update(visible=False), # video_column
|
173 |
gr.update(value=""), # video1
|
174 |
gr.update(value=""), # video2
|
|
|
175 |
gr.update(visible=False), # question_column
|
176 |
gr.update(visible=False), # button_row
|
177 |
"", # output
|
@@ -208,6 +213,7 @@ def authenticate_user(email, state):
|
|
208 |
gr.update(visible=False), # video_column
|
209 |
gr.update(value=""), # video1
|
210 |
gr.update(value=""), # video2
|
|
|
211 |
gr.update(visible=False), # question_column
|
212 |
gr.update(visible=False), # button_row
|
213 |
output_message, # output
|
@@ -216,6 +222,7 @@ def authenticate_user(email, state):
|
|
216 |
else:
|
217 |
video1_html = generate_video_html(video1_url)
|
218 |
video2_html = generate_video_html(video2_url)
|
|
|
219 |
return (
|
220 |
gr.update(visible=False), # email_input
|
221 |
gr.update(visible=False), # submit_email
|
@@ -224,6 +231,7 @@ def authenticate_user(email, state):
|
|
224 |
gr.update(visible=True), # video_column
|
225 |
gr.update(value=video1_html), # video1
|
226 |
gr.update(value=video2_html), # video2
|
|
|
227 |
gr.update(visible=True), # question_column
|
228 |
gr.update(visible=True), # button_row
|
229 |
"", # output
|
@@ -235,12 +243,13 @@ with gr.Blocks() as demo:
|
|
235 |
|
236 |
gr.Markdown(
|
237 |
"""
|
238 |
-
You'll be seeing
|
239 |
-
|
240 |
-
|
|
|
241 |
|
242 |
**There are 10 videos in total.**
|
243 |
-
**
|
244 |
"""
|
245 |
)
|
246 |
|
@@ -250,26 +259,31 @@ with gr.Blocks() as demo:
|
|
250 |
email_output = gr.Markdown()
|
251 |
|
252 |
# Video components (initially hidden)
|
253 |
-
with gr.
|
254 |
-
with gr.Column(
|
255 |
-
gr.Markdown("### Video
|
256 |
-
|
257 |
|
258 |
-
with gr.
|
259 |
-
gr.
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
# Questions (initially hidden)
|
263 |
with gr.Column(visible=False) as question_column:
|
264 |
gr.Markdown("## Please answer the following questions:")
|
265 |
q1 = gr.Radio(
|
266 |
choices=["Video 1", "Video 2", "No preference"],
|
267 |
-
label="1. Which video
|
268 |
type="value"
|
269 |
)
|
270 |
q2 = gr.Radio(
|
271 |
choices=["Video 1", "Video 2", "No preference"],
|
272 |
-
label="2. Which video
|
273 |
type="value"
|
274 |
)
|
275 |
|
@@ -295,6 +309,7 @@ with gr.Blocks() as demo:
|
|
295 |
video2_column, # Update video_column
|
296 |
video1, # Update video1
|
297 |
video2, # Update video2
|
|
|
298 |
question_column, # Update question_column
|
299 |
button_row, # Update button_row
|
300 |
output, # Update output message
|
@@ -329,6 +344,7 @@ with gr.Blocks() as demo:
|
|
329 |
video2_column, # Update video_column
|
330 |
video1, # Update video1
|
331 |
video2, # Update video2
|
|
|
332 |
question_column, # Update question_column
|
333 |
button_row, # Update button_row
|
334 |
output, # Update output message
|
|
|
12 |
|
13 |
load_dotenv()
|
14 |
|
15 |
+
video_pairs = pd.read_csv('file_pairs.csv')[['file_name', 'vista_id', 'gem_id', 'rgb_id']].values.tolist()
|
16 |
random.seed(42)
|
17 |
random.shuffle(video_pairs)
|
18 |
|
|
|
45 |
shuffled_pairs = state['shuffled_pairs']
|
46 |
user_votes = state['user_votes']
|
47 |
while pair_index < len(shuffled_pairs):
|
48 |
+
video_name, vista_id, gem_id, rgb_id = shuffled_pairs[pair_index]
|
49 |
pair_key = f"{vista_id}_{gem_id}"
|
50 |
+
state['rgb_id'] = rgb_id
|
51 |
if pair_key not in user_votes:
|
52 |
# Randomize left-right positions
|
53 |
if random.choice([True, False]):
|
|
|
126 |
gr.update(visible=False), # video_column
|
127 |
gr.update(value=""), # video1
|
128 |
gr.update(value=""), # video2
|
129 |
+
gr.update(value=""), # rgb_video
|
130 |
gr.update(visible=False), # question_column
|
131 |
gr.update(visible=False), # button_row
|
132 |
output_message, # output
|
|
|
138 |
else:
|
139 |
video1_html = generate_video_html(video1_url)
|
140 |
video2_html = generate_video_html(video2_url)
|
141 |
+
rgb_html = generate_video_html(get_embed_link(state['rgb_id']))
|
142 |
# Update videos and reset questions
|
143 |
return (
|
144 |
gr.update(visible=True), # video_column
|
145 |
gr.update(visible=True), # video_column
|
146 |
gr.update(value=video1_html), # video1
|
147 |
gr.update(value=video2_html), # video2
|
148 |
+
gr.update(value=rgb_html), # rgb_video
|
149 |
gr.update(visible=True), # question_column
|
150 |
gr.update(visible=True), # button_row
|
151 |
"", # output
|
|
|
176 |
gr.update(visible=False), # video_column
|
177 |
gr.update(value=""), # video1
|
178 |
gr.update(value=""), # video2
|
179 |
+
gr.update(value=""), # rgb_video
|
180 |
gr.update(visible=False), # question_column
|
181 |
gr.update(visible=False), # button_row
|
182 |
"", # output
|
|
|
213 |
gr.update(visible=False), # video_column
|
214 |
gr.update(value=""), # video1
|
215 |
gr.update(value=""), # video2
|
216 |
+
gr.update(value=""), # rgb_video
|
217 |
gr.update(visible=False), # question_column
|
218 |
gr.update(visible=False), # button_row
|
219 |
output_message, # output
|
|
|
222 |
else:
|
223 |
video1_html = generate_video_html(video1_url)
|
224 |
video2_html = generate_video_html(video2_url)
|
225 |
+
rgb_html = generate_video_html(get_embed_link(state['rgb_id']))
|
226 |
return (
|
227 |
gr.update(visible=False), # email_input
|
228 |
gr.update(visible=False), # submit_email
|
|
|
231 |
gr.update(visible=True), # video_column
|
232 |
gr.update(value=video1_html), # video1
|
233 |
gr.update(value=video2_html), # video2
|
234 |
+
gr.update(value=rgb_html), # rgb_video
|
235 |
gr.update(visible=True), # question_column
|
236 |
gr.update(visible=True), # button_row
|
237 |
"", # output
|
|
|
243 |
|
244 |
gr.Markdown(
|
245 |
"""
|
246 |
+
You'll be seeing three videos per question.
|
247 |
+
At the top, you'll see a video with the RGB view.
|
248 |
+
Below, you'll see two depth videos.
|
249 |
+
You'll be asked to select which depth video seems to be better quality with respect to the RGB video.
|
250 |
|
251 |
**There are 10 videos in total.**
|
252 |
+
**Avoid "No preference" answers as much as possible.**
|
253 |
"""
|
254 |
)
|
255 |
|
|
|
259 |
email_output = gr.Markdown()
|
260 |
|
261 |
# Video components (initially hidden)
|
262 |
+
with gr.Column():
|
263 |
+
with gr.Column() as video1_column:
|
264 |
+
gr.Markdown("### RGB Video")
|
265 |
+
rgb_video = gr.HTML()
|
266 |
|
267 |
+
with gr.Row():
|
268 |
+
with gr.Column(visible=False) as video1_column:
|
269 |
+
gr.Markdown("### Video 1")
|
270 |
+
video1 = gr.HTML()
|
271 |
+
|
272 |
+
with gr.Column(visible=False) as video2_column:
|
273 |
+
gr.Markdown("### Video 2")
|
274 |
+
video2 = gr.HTML()
|
275 |
|
276 |
# Questions (initially hidden)
|
277 |
with gr.Column(visible=False) as question_column:
|
278 |
gr.Markdown("## Please answer the following questions:")
|
279 |
q1 = gr.Radio(
|
280 |
choices=["Video 1", "Video 2", "No preference"],
|
281 |
+
label="1. Which depth video is more aligned with RGB?",
|
282 |
type="value"
|
283 |
)
|
284 |
q2 = gr.Radio(
|
285 |
choices=["Video 1", "Video 2", "No preference"],
|
286 |
+
label="2. Which depth video is more consistent and has less flickering?",
|
287 |
type="value"
|
288 |
)
|
289 |
|
|
|
309 |
video2_column, # Update video_column
|
310 |
video1, # Update video1
|
311 |
video2, # Update video2
|
312 |
+
rgb_video,
|
313 |
question_column, # Update question_column
|
314 |
button_row, # Update button_row
|
315 |
output, # Update output message
|
|
|
344 |
video2_column, # Update video_column
|
345 |
video1, # Update video1
|
346 |
video2, # Update video2
|
347 |
+
rgb_video,
|
348 |
question_column, # Update question_column
|
349 |
button_row, # Update button_row
|
350 |
output, # Update output message
|
file_pairs.csv
CHANGED
@@ -1,11 +1,31 @@
|
|
1 |
-
file_name,vista_id,gem_id
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
file_name,vista_id,gem_id,rgb_id
|
2 |
+
depth_0,1051869114,1051868252,1051868659
|
3 |
+
depth_1,1051869131,1051868261,1051868677
|
4 |
+
depth_10,1051869294,1051868402,1051868797
|
5 |
+
depth_11,1051869311,1051868422,1051868815
|
6 |
+
depth_12,1051869328,1051868431,1051868834
|
7 |
+
depth_13,1051869340,1051868440,1051868848
|
8 |
+
depth_14,1051869351,1051868451,1051868862
|
9 |
+
depth_15,1051869373,1051868464,1051868881
|
10 |
+
depth_16,1051869389,1051868477,1051868892
|
11 |
+
depth_17,1051869407,1051868495,1051868912
|
12 |
+
depth_18,1051869418,1051868506,1051868922
|
13 |
+
depth_19,1051869430,1051868515,1051868936
|
14 |
+
depth_2,1051869155,1051868274,1051868693
|
15 |
+
depth_20,1051869443,1051868536,1051868954
|
16 |
+
depth_21,1051869464,1051868550,1051868968
|
17 |
+
depth_22,1051869476,1051868561,1051868988
|
18 |
+
depth_23,1051869491,1051868570,1051869003
|
19 |
+
depth_24,1051869507,1051868582,1051869021
|
20 |
+
depth_25,1051869527,1051868595,1051869033
|
21 |
+
depth_26,1051869550,1051868603,1051869043
|
22 |
+
depth_27,1051869570,1051868613,1051869061
|
23 |
+
depth_28,1051869584,1051868631,1051869073
|
24 |
+
depth_3,1051869166,1051868288,1051868710
|
25 |
+
depth_4,1051869183,1051868302,1051868726
|
26 |
+
depth_5,1051869203,1051868323,1051868745
|
27 |
+
depth_6,1051869219,1051868339,1051868756
|
28 |
+
depth_7,1051869243,1051868357,1051868771
|
29 |
+
depth_8,1051869262,1051868375,1051868781
|
30 |
+
depth_9,1051869278,1051868387,1051868789
|
31 |
+
depth_99,1051869604,1051868642,1051869092
|
get_vimeo.py
CHANGED
@@ -13,8 +13,12 @@ v = vimeo.VimeoClient(
|
|
13 |
user_id = 'pedroooombr' # Replace with the actual user ID
|
14 |
endpoint = f'/users/{user_id}/videos'
|
15 |
# Make the GET request
|
16 |
-
response1 = v.get(f'{endpoint}?per_page=
|
|
|
|
|
17 |
response = response1
|
|
|
|
|
18 |
|
19 |
gem_videos = [
|
20 |
("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('GEM')
|
@@ -24,7 +28,11 @@ vista_videos = [
|
|
24 |
("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('Vista')
|
25 |
]
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
assert len(gem_videos) == len(vista_videos)
|
29 |
|
30 |
# Match files by title and create a csv
|
@@ -32,10 +40,11 @@ data = []
|
|
32 |
|
33 |
for vista_file in vista_videos:
|
34 |
for gem_file in gem_videos:
|
35 |
-
|
36 |
-
|
|
|
37 |
|
38 |
# sort by file_name
|
39 |
data.sort(key=lambda x: x[0])
|
40 |
-
df = pd.DataFrame(data, columns=['file_name', 'vista_id', 'gem_id'])
|
41 |
df.to_csv('file_pairs.csv', index=False)
|
|
|
13 |
user_id = 'pedroooombr' # Replace with the actual user ID
|
14 |
endpoint = f'/users/{user_id}/videos'
|
15 |
# Make the GET request
|
16 |
+
response1 = v.get(f'{endpoint}?per_page=100').json()
|
17 |
+
# response2 = v.get(f'{endpoint}?per_page=100&page=2').json()
|
18 |
+
# response3 = v.get(f'{endpoint}?per_page=100&page=3').json()
|
19 |
response = response1
|
20 |
+
# response['data'].extend(response2['data'])
|
21 |
+
# response['data'].extend(response3['data'])
|
22 |
|
23 |
gem_videos = [
|
24 |
("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('GEM')
|
|
|
28 |
("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('Vista')
|
29 |
]
|
30 |
|
31 |
+
rgb_videos = [
|
32 |
+
("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('rgb_')
|
33 |
+
]
|
34 |
+
|
35 |
+
print(len(gem_videos), len(vista_videos), len(rgb_videos))
|
36 |
assert len(gem_videos) == len(vista_videos)
|
37 |
|
38 |
# Match files by title and create a csv
|
|
|
40 |
|
41 |
for vista_file in vista_videos:
|
42 |
for gem_file in gem_videos:
|
43 |
+
for rgb_file in rgb_videos:
|
44 |
+
if vista_file[0] == gem_file[0] and vista_file[0] == "depth_" + rgb_file[0]:
|
45 |
+
data.append((vista_file[0], vista_file[1], gem_file[1], rgb_file[1]))
|
46 |
|
47 |
# sort by file_name
|
48 |
data.sort(key=lambda x: x[0])
|
49 |
+
df = pd.DataFrame(data, columns=['file_name', 'vista_id', 'gem_id', 'rgb_id'])
|
50 |
df.to_csv('file_pairs.csv', index=False)
|
results.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
category,gem,vista,no_preference
|
2 |
-
q1,
|
3 |
-
q2,
|
|
|
1 |
category,gem,vista,no_preference
|
2 |
+
q1,59,8,11
|
3 |
+
q2,52,12,14
|