WitneyWW commited on
Commit
5ff6bdb
Β·
1 Parent(s): a4222ff

object-specific questions that state the claim being judged

Browse files
Files changed (1) hide show
  1. app.py +42 -1
app.py CHANGED
@@ -68,6 +68,47 @@ if RESP_CSV.exists():
68
  RESP_CSV.rename(RESP_DIR / f"responses_old_{datetime.now():%Y%m%d_%H%M%S}.csv")
69
 
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  def narrations_of(it):
72
  return sorted(it["events"]["narration"], key=lambda e: e["t0"])
73
 
@@ -204,7 +245,7 @@ def show(idx, annotator):
204
  status = "βœ… answered" if item_key(it) in done else "⬜ not answered"
205
  header = f"### {annotator or '?'} β€” item {idx + 1} / {N}   {status}   ({len(done)} / {N} done)"
206
  return ([idx, header, str(MEDIA / it["clip"]), gallery_for(it), annotation_md(it), crosscheck_md(it)]
207
- + [None] * len(DIMENSIONS) + narration_updates(it) + [""])
208
 
209
 
210
  def first_unanswered(annotator):
 
68
  RESP_CSV.rename(RESP_DIR / f"responses_old_{datetime.now():%Y%m%d_%H%M%S}.csv")
69
 
70
 
71
+ def _join(xs):
72
+ return "; ".join(f"({i + 1}) {x}" for i, x in enumerate(xs))
73
+
74
+
75
+ def dim_questions(it):
76
+ """The six fixed questions, written out for THIS object: each one states the claim
77
+ being judged (or, when the memory records nothing, asks whether nothing is right)."""
78
+ a, ev, att = it["annotation"], it.get("events") or {}, it.get("attention") or {}
79
+ name = f"β€œ{a.get('category')}” ({it['object_id']})"
80
+ now = a.get("now") or {}
81
+ q = {}
82
+ q["identity"] = (f"1. Identity β€” the memory says the object in the red box is a {name} that looks like "
83
+ f"β€œ{a.get('looks_like')}”. Is that what the object is and looks like?")
84
+ q["localization"] = (f"2. Localization β€” do the red box (video + keyframes) and the green mask (keyframes) "
85
+ f"cover the {name}, and not a neighbouring object, the hand, or background?")
86
+ hist = a.get("history") or []
87
+ q["state_history"] = (f"3. Location history of the {name} β€” the memory says: {_join(hist)}. "
88
+ f"At the end it is β€œ{now.get('relation')} {now.get('at')}”. Are the places and times correct?")
89
+ moves = a.get("moves") or []
90
+ q["moves"] = (f"4. Moves β€” the memory records these moves of the {name}: {_join(moves)}. "
91
+ "Are the from β†’ to and the times correct, and is no move missing?"
92
+ if moves else
93
+ f"4. Moves β€” the memory records NO move for the {name}. Do you agree that this object was "
94
+ "not moved from one place to another during the clip?")
95
+ snd = [f"{e['label']} [{e['t0']:.1f}–{e['t1']:.1f}s]" for e in ev.get("sound") or []]
96
+ sp = [f"β€œ{e['label']}” [{e['t0']:.1f}–{e['t1']:.1f}s]" for e in ev.get("speech") or []]
97
+ q["sound_speech"] = ((f"5. Sounds β€” the memory links these sounds to the {name}: {_join(snd)}. "
98
+ "Was each of them made by (or with) this object?"
99
+ if snd else
100
+ f"5. Sounds β€” the memory links NO sound to the {name}. Do you agree that this object "
101
+ "made no audible sound in the clip?")
102
+ + (f" Speech heard in the clip: {_join(sp)} β€” is it transcribed correctly?" if sp else ""))
103
+ dwell = [f"{e['t0']:.1f}–{e['t1']:.1f}s" for e in ev.get("dwell") or []]
104
+ q["gaze"] = (f"6. Gaze β€” the memory says the wearer looked at the {name} (first at {att.get('first_gaze_sec')}s; "
105
+ f"dwell {', '.join(dwell)}). During those times, is the red gaze dot on or right next to this object?"
106
+ if a.get("looked_at") else
107
+ f"6. Gaze β€” the memory says the wearer did NOT look at the {name} before handling it. "
108
+ "Do you agree β€” does the red gaze dot stay off this object before it is touched?")
109
+ return [gr.update(label=q[k], value=None) for k, _ in DIMENSIONS]
110
+
111
+
112
  def narrations_of(it):
113
  return sorted(it["events"]["narration"], key=lambda e: e["t0"])
114
 
 
245
  status = "βœ… answered" if item_key(it) in done else "⬜ not answered"
246
  header = f"### {annotator or '?'} β€” item {idx + 1} / {N}   {status}   ({len(done)} / {N} done)"
247
  return ([idx, header, str(MEDIA / it["clip"]), gallery_for(it), annotation_md(it), crosscheck_md(it)]
248
+ + dim_questions(it) + narration_updates(it) + [""])
249
 
250
 
251
  def first_unanswered(annotator):