FangSen9000 commited on
Commit
3a4b7bf
·
1 Parent(s): 193d58a

Remove "Position" to make the display more tidy.

Browse files
SignX/detailed_prediction_20251226_235251/sample_000/analysis_report.txt ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ================================================================================
2
+ Sign Language Recognition - Attention分析报告
3
+ ================================================================================
4
+
5
+ 生成时间: 2025-12-26 23:52:55
6
+
7
+ 翻译结果:
8
+ --------------------------------------------------------------------------------
9
+ <unk> #IF FRIEND GROUP/TOGETHER DEPART PARTY IX-1p FINISH JOIN IX-1p
10
+
11
+ 视频信息:
12
+ --------------------------------------------------------------------------------
13
+ 总帧数: 28
14
+ 词数量: 10
15
+
16
+ Attention权重信息:
17
+ --------------------------------------------------------------------------------
18
+ 形状: (28, 8, 28)
19
+ - 解码步数: 28
20
+ - Batch大小: 8
21
+
22
+ 词-帧对应详情:
23
+ ================================================================================
24
+ No. Word Frames Peak Attn Conf
25
+ --------------------------------------------------------------------------------
26
+ 1 <unk> 0-0 0 0.133 low
27
+ 2 #IF 2-3 2 0.359 medium
28
+ 3 FRIEND 5-5 5 0.449 medium
29
+ 4 GROUP/TOGETHER 8-8 8 0.371 medium
30
+ 5 DEPART 27-27 27 0.305 medium
31
+ 6 PARTY 27-27 27 0.296 medium
32
+ 7 IX-1p 27-27 27 0.326 medium
33
+ 8 FINISH 11-12 12 0.467 medium
34
+ 9 JOIN 13-14 14 0.317 medium
35
+ 10 IX-1p 17-17 17 0.358 medium
36
+
37
+ ================================================================================
38
+
39
+ 统计摘要:
40
+ --------------------------------------------------------------------------------
41
+ 平均attention权重: 0.338
42
+ 高置信度词: 0 (0.0%)
43
+ 中置信度词: 9 (90.0%)
44
+ 低置信度词: 1 (10.0%)
45
+
46
+ ================================================================================
SignX/detailed_prediction_20251226_235251/sample_000/attention_heatmap.png ADDED

Git LFS Details

  • SHA256: 1800fdb9056d72106a749612f67365fc3dadf613b8c5f1bfc43b11a83fd35ca7
  • Pointer size: 130 Bytes
  • Size of remote file: 86 kB
SignX/detailed_prediction_20251226_235251/sample_000/attention_weights.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7414e5ab870540255a4bc963aa612d837eca27b95da7b4603c4c8e39f82b8c01
3
+ size 25216
SignX/detailed_prediction_20251226_235251/sample_000/debug_video_path.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ video_path = '/common/users/sf895/output/huggingface_asllrp_repo/SignX/eval/tiny_test_data/videos/632051.mp4'
2
+ video_path type = <class 'str'>
3
+ video_path is None: False
4
+ bool(video_path): True
SignX/detailed_prediction_20251226_235251/sample_000/feature_frame_mapping.json ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "original_frame_count": 106,
3
+ "feature_count": 28,
4
+ "downsampling_ratio": 3.7857142857142856,
5
+ "fps": 24.0,
6
+ "mapping": [
7
+ {
8
+ "feature_index": 0,
9
+ "frame_start": 0,
10
+ "frame_end": 3,
11
+ "frame_count": 3
12
+ },
13
+ {
14
+ "feature_index": 1,
15
+ "frame_start": 3,
16
+ "frame_end": 7,
17
+ "frame_count": 4
18
+ },
19
+ {
20
+ "feature_index": 2,
21
+ "frame_start": 7,
22
+ "frame_end": 11,
23
+ "frame_count": 4
24
+ },
25
+ {
26
+ "feature_index": 3,
27
+ "frame_start": 11,
28
+ "frame_end": 15,
29
+ "frame_count": 4
30
+ },
31
+ {
32
+ "feature_index": 4,
33
+ "frame_start": 15,
34
+ "frame_end": 18,
35
+ "frame_count": 3
36
+ },
37
+ {
38
+ "feature_index": 5,
39
+ "frame_start": 18,
40
+ "frame_end": 22,
41
+ "frame_count": 4
42
+ },
43
+ {
44
+ "feature_index": 6,
45
+ "frame_start": 22,
46
+ "frame_end": 26,
47
+ "frame_count": 4
48
+ },
49
+ {
50
+ "feature_index": 7,
51
+ "frame_start": 26,
52
+ "frame_end": 30,
53
+ "frame_count": 4
54
+ },
55
+ {
56
+ "feature_index": 8,
57
+ "frame_start": 30,
58
+ "frame_end": 34,
59
+ "frame_count": 4
60
+ },
61
+ {
62
+ "feature_index": 9,
63
+ "frame_start": 34,
64
+ "frame_end": 37,
65
+ "frame_count": 3
66
+ },
67
+ {
68
+ "feature_index": 10,
69
+ "frame_start": 37,
70
+ "frame_end": 41,
71
+ "frame_count": 4
72
+ },
73
+ {
74
+ "feature_index": 11,
75
+ "frame_start": 41,
76
+ "frame_end": 45,
77
+ "frame_count": 4
78
+ },
79
+ {
80
+ "feature_index": 12,
81
+ "frame_start": 45,
82
+ "frame_end": 49,
83
+ "frame_count": 4
84
+ },
85
+ {
86
+ "feature_index": 13,
87
+ "frame_start": 49,
88
+ "frame_end": 53,
89
+ "frame_count": 4
90
+ },
91
+ {
92
+ "feature_index": 14,
93
+ "frame_start": 53,
94
+ "frame_end": 56,
95
+ "frame_count": 3
96
+ },
97
+ {
98
+ "feature_index": 15,
99
+ "frame_start": 56,
100
+ "frame_end": 60,
101
+ "frame_count": 4
102
+ },
103
+ {
104
+ "feature_index": 16,
105
+ "frame_start": 60,
106
+ "frame_end": 64,
107
+ "frame_count": 4
108
+ },
109
+ {
110
+ "feature_index": 17,
111
+ "frame_start": 64,
112
+ "frame_end": 68,
113
+ "frame_count": 4
114
+ },
115
+ {
116
+ "feature_index": 18,
117
+ "frame_start": 68,
118
+ "frame_end": 71,
119
+ "frame_count": 3
120
+ },
121
+ {
122
+ "feature_index": 19,
123
+ "frame_start": 71,
124
+ "frame_end": 75,
125
+ "frame_count": 4
126
+ },
127
+ {
128
+ "feature_index": 20,
129
+ "frame_start": 75,
130
+ "frame_end": 79,
131
+ "frame_count": 4
132
+ },
133
+ {
134
+ "feature_index": 21,
135
+ "frame_start": 79,
136
+ "frame_end": 83,
137
+ "frame_count": 4
138
+ },
139
+ {
140
+ "feature_index": 22,
141
+ "frame_start": 83,
142
+ "frame_end": 87,
143
+ "frame_count": 4
144
+ },
145
+ {
146
+ "feature_index": 23,
147
+ "frame_start": 87,
148
+ "frame_end": 90,
149
+ "frame_count": 3
150
+ },
151
+ {
152
+ "feature_index": 24,
153
+ "frame_start": 90,
154
+ "frame_end": 94,
155
+ "frame_count": 4
156
+ },
157
+ {
158
+ "feature_index": 25,
159
+ "frame_start": 94,
160
+ "frame_end": 98,
161
+ "frame_count": 4
162
+ },
163
+ {
164
+ "feature_index": 26,
165
+ "frame_start": 98,
166
+ "frame_end": 102,
167
+ "frame_count": 4
168
+ },
169
+ {
170
+ "feature_index": 27,
171
+ "frame_start": 102,
172
+ "frame_end": 106,
173
+ "frame_count": 4
174
+ }
175
+ ]
176
+ }
SignX/detailed_prediction_20251226_235251/sample_000/frame_alignment.json ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "translation": "<unk> #IF FRIEND GROUP/TOGETHER DEPART PARTY IX-1p FINISH JOIN IX-1p",
3
+ "words": [
4
+ "<unk>",
5
+ "#IF",
6
+ "FRIEND",
7
+ "GROUP/TOGETHER",
8
+ "DEPART",
9
+ "PARTY",
10
+ "IX-1p",
11
+ "FINISH",
12
+ "JOIN",
13
+ "IX-1p"
14
+ ],
15
+ "total_video_frames": 28,
16
+ "frame_ranges": [
17
+ {
18
+ "word": "<unk>",
19
+ "start_frame": 0,
20
+ "end_frame": 0,
21
+ "peak_frame": 0,
22
+ "avg_attention": 0.13272422552108765,
23
+ "confidence": "low"
24
+ },
25
+ {
26
+ "word": "#IF",
27
+ "start_frame": 2,
28
+ "end_frame": 3,
29
+ "peak_frame": 2,
30
+ "avg_attention": 0.35901427268981934,
31
+ "confidence": "medium"
32
+ },
33
+ {
34
+ "word": "FRIEND",
35
+ "start_frame": 5,
36
+ "end_frame": 5,
37
+ "peak_frame": 5,
38
+ "avg_attention": 0.4494199752807617,
39
+ "confidence": "medium"
40
+ },
41
+ {
42
+ "word": "GROUP/TOGETHER",
43
+ "start_frame": 8,
44
+ "end_frame": 8,
45
+ "peak_frame": 8,
46
+ "avg_attention": 0.3710141181945801,
47
+ "confidence": "medium"
48
+ },
49
+ {
50
+ "word": "DEPART",
51
+ "start_frame": 27,
52
+ "end_frame": 27,
53
+ "peak_frame": 27,
54
+ "avg_attention": 0.30533191561698914,
55
+ "confidence": "medium"
56
+ },
57
+ {
58
+ "word": "PARTY",
59
+ "start_frame": 27,
60
+ "end_frame": 27,
61
+ "peak_frame": 27,
62
+ "avg_attention": 0.2963099479675293,
63
+ "confidence": "medium"
64
+ },
65
+ {
66
+ "word": "IX-1p",
67
+ "start_frame": 27,
68
+ "end_frame": 27,
69
+ "peak_frame": 27,
70
+ "avg_attention": 0.3264133930206299,
71
+ "confidence": "medium"
72
+ },
73
+ {
74
+ "word": "FINISH",
75
+ "start_frame": 11,
76
+ "end_frame": 12,
77
+ "peak_frame": 12,
78
+ "avg_attention": 0.46679070591926575,
79
+ "confidence": "medium"
80
+ },
81
+ {
82
+ "word": "JOIN",
83
+ "start_frame": 13,
84
+ "end_frame": 14,
85
+ "peak_frame": 14,
86
+ "avg_attention": 0.3172740340232849,
87
+ "confidence": "medium"
88
+ },
89
+ {
90
+ "word": "IX-1p",
91
+ "start_frame": 17,
92
+ "end_frame": 17,
93
+ "peak_frame": 17,
94
+ "avg_attention": 0.3579559326171875,
95
+ "confidence": "medium"
96
+ }
97
+ ],
98
+ "statistics": {
99
+ "avg_confidence": 0.33822485208511355,
100
+ "high_confidence_words": 0,
101
+ "medium_confidence_words": 9,
102
+ "low_confidence_words": 1
103
+ }
104
+ }
SignX/detailed_prediction_20251226_235251/sample_000/frame_alignment.png ADDED

Git LFS Details

  • SHA256: 43235fc9c408e0fd4a57600870ce52ecaa06288efb8d4873563f3d94108c99a7
  • Pointer size: 131 Bytes
  • Size of remote file: 160 kB
SignX/detailed_prediction_20251226_235251/sample_000/gloss_to_frames.png ADDED

Git LFS Details

  • SHA256: be0107f8422abf280bd04d50563dd83c208e2983729e2a4b4be4dfdb51112b00
  • Pointer size: 132 Bytes
  • Size of remote file: 4.59 MB
SignX/detailed_prediction_20251226_235251/sample_000/interactive_alignment.html ADDED
@@ -0,0 +1,579 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Interactive Word-Frame Alignment</title>
7
+ <style>
8
+ body {
9
+ font-family: 'Arial', sans-serif;
10
+ margin: 20px;
11
+ background-color: #f5f5f5;
12
+ }
13
+ .container {
14
+ max-width: 1800px;
15
+ margin: 0 auto;
16
+ background-color: white;
17
+ padding: 30px;
18
+ border-radius: 8px;
19
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
20
+ }
21
+ h1 {
22
+ color: #333;
23
+ border-bottom: 3px solid #4CAF50;
24
+ padding-bottom: 10px;
25
+ margin-bottom: 20px;
26
+ }
27
+ .stats {
28
+ background-color: #E3F2FD;
29
+ padding: 15px;
30
+ border-radius: 5px;
31
+ margin-bottom: 20px;
32
+ border-left: 4px solid #2196F3;
33
+ font-size: 14px;
34
+ }
35
+ .controls {
36
+ background-color: #f9f9f9;
37
+ padding: 20px;
38
+ border-radius: 5px;
39
+ margin-bottom: 30px;
40
+ border: 1px solid #ddd;
41
+ }
42
+ .control-group {
43
+ margin-bottom: 15px;
44
+ }
45
+ label {
46
+ font-weight: bold;
47
+ display: inline-block;
48
+ width: 250px;
49
+ color: #555;
50
+ }
51
+ input[type="range"] {
52
+ width: 400px;
53
+ vertical-align: middle;
54
+ }
55
+ .value-display {
56
+ display: inline-block;
57
+ width: 80px;
58
+ font-family: monospace;
59
+ font-size: 14px;
60
+ color: #2196F3;
61
+ font-weight: bold;
62
+ }
63
+ .reset-btn {
64
+ margin-top: 15px;
65
+ padding: 10px 25px;
66
+ background-color: #2196F3;
67
+ color: white;
68
+ border: none;
69
+ border-radius: 5px;
70
+ cursor: pointer;
71
+ font-size: 14px;
72
+ font-weight: bold;
73
+ }
74
+ .reset-btn:hover {
75
+ background-color: #1976D2;
76
+ }
77
+ canvas {
78
+ border: 1px solid #999;
79
+ display: block;
80
+ margin: 20px auto;
81
+ background: white;
82
+ }
83
+ .legend {
84
+ margin-top: 20px;
85
+ padding: 15px;
86
+ background-color: #fff;
87
+ border: 1px solid #ddd;
88
+ border-radius: 5px;
89
+ }
90
+ .legend-item {
91
+ display: inline-block;
92
+ margin-right: 25px;
93
+ font-size: 13px;
94
+ margin-bottom: 10px;
95
+ }
96
+ .color-box {
97
+ display: inline-block;
98
+ width: 30px;
99
+ height: 15px;
100
+ margin-right: 8px;
101
+ vertical-align: middle;
102
+ border: 1px solid #666;
103
+ }
104
+ .info-panel {
105
+ margin-top: 20px;
106
+ padding: 15px;
107
+ background-color: #f9f9f9;
108
+ border-radius: 5px;
109
+ border: 1px solid #ddd;
110
+ }
111
+ .confidence {
112
+ display: inline-block;
113
+ padding: 3px 10px;
114
+ border-radius: 10px;
115
+ font-weight: bold;
116
+ font-size: 11px;
117
+ text-transform: uppercase;
118
+ }
119
+ .confidence.high {
120
+ background-color: #4CAF50;
121
+ color: white;
122
+ }
123
+ .confidence.medium {
124
+ background-color: #FF9800;
125
+ color: white;
126
+ }
127
+ .confidence.low {
128
+ background-color: #f44336;
129
+ color: white;
130
+ }
131
+ </style>
132
+ </head>
133
+ <body>
134
+ <div class="container">
135
+ <h1>🎯 Interactive Word-to-Frame Alignment Visualizer</h1>
136
+
137
+ <div class="stats">
138
+ <strong>Translation:</strong> <unk> #IF FRIEND GROUP/TOGETHER DEPART PARTY IX-1p FINISH JOIN IX-1p<br>
139
+ <strong>Total Words:</strong> 10 |
140
+ <strong>Total Features:</strong> 8
141
+ </div>
142
+
143
+ <div class="controls">
144
+ <h3>⚙️ Threshold Controls</h3>
145
+
146
+ <div class="control-group">
147
+ <label for="peak-threshold">Peak Threshold (% of max):</label>
148
+ <input type="range" id="peak-threshold" min="1" max="100" value="90" step="1">
149
+ <span class="value-display" id="peak-threshold-value">90%</span>
150
+ <br>
151
+ <small style="margin-left: 255px; color: #666;">
152
+ 帧的注意力权重 ≥ (峰值权重 × 阈值%) 时被认为是"显著帧"
153
+ </small>
154
+ </div>
155
+
156
+ <div class="control-group">
157
+ <label for="confidence-high">High Confidence (avg attn >):</label>
158
+ <input type="range" id="confidence-high" min="0" max="100" value="50" step="1">
159
+ <span class="value-display" id="confidence-high-value">0.50</span>
160
+ </div>
161
+
162
+ <div class="control-group">
163
+ <label for="confidence-medium">Medium Confidence (avg attn >):</label>
164
+ <input type="range" id="confidence-medium" min="0" max="100" value="20" step="1">
165
+ <span class="value-display" id="confidence-medium-value">0.20</span>
166
+ </div>
167
+
168
+ <button class="reset-btn" onclick="resetDefaults()">
169
+ Reset to Defaults
170
+ </button>
171
+ </div>
172
+
173
+ <div>
174
+ <h3>Word-to-Frame Alignment</h3>
175
+ <p style="color: #666; font-size: 13px;">
176
+ 每个词显示为彩色矩形,宽度表示该词对应的特征帧范围。★ = 峰值帧。矩形内部显示注意力权重波形。
177
+ </p>
178
+ <canvas id="alignment-canvas" width="1600" height="600"></canvas>
179
+
180
+ <h3 style="margin-top: 30px;">Timeline Progress Bar</h3>
181
+ <canvas id="timeline-canvas" width="1600" height="100"></canvas>
182
+
183
+ <div class="legend">
184
+ <strong>Legend:</strong><br><br>
185
+ <div class="legend-item">
186
+ <span class="confidence high">High</span>
187
+ <span class="confidence medium">Medium</span>
188
+ <span class="confidence low">Low</span>
189
+ Confidence Levels (opacity reflects confidence)
190
+ </div>
191
+ <div class="legend-item">
192
+ <span style="color: red; font-size: 20px;">★</span>
193
+ Peak Frame (highest attention)
194
+ </div>
195
+ <div class="legend-item">
196
+ <span style="color: blue;">━</span>
197
+ Attention Waveform (within word region)
198
+ </div>
199
+ </div>
200
+ </div>
201
+
202
+ <div class="info-panel">
203
+ <h3>Alignment Details</h3>
204
+ <div id="alignment-details"></div>
205
+ </div>
206
+ </div>
207
+
208
+ <script>
209
+ // Attention data from Python
210
+ const attentionData = [{"word": "<unk>", "word_idx": 0, "weights": [0.13272422552108765, 0.13272422552108765, 0.13272422552108765, 0.13272422552108765, 0.13272422552108765, 0.13272422552108765, 0.13272422552108765, 0.13272422552108765]}, {"word": "#IF", "word_idx": 1, "weights": [0.035573869943618774, 0.03952416777610779, 0.03952416777610779, 0.03952416777610779, 0.03952416777610779, 0.03952416777610779, 0.03952416777610779, 0.04215671867132187]}, {"word": "FRIEND", "word_idx": 2, "weights": [0.0035305300261825323, 0.06121520698070526, 0.038338951766490936, 0.03721731901168823, 0.0396437793970108, 0.06121520698070526, 0.03798501193523407, 0.06121520698070526]}, {"word": "GROUP/TOGETHER", "word_idx": 3, "weights": [0.0032519344240427017, 0.06749927252531052, 0.06769093871116638, 0.06797394156455994, 0.05660902336239815, 0.0032519344240427017, 0.06791087239980698, 0.06749927252531052]}, {"word": "DEPART", "word_idx": 4, "weights": [0.1269645392894745, 0.011337662115693092, 0.011169591918587685, 0.011129447259008884, 0.011337662115693092, 0.14123021066188812, 0.007393963634967804, 0.011116056703031063]}, {"word": "PARTY", "word_idx": 5, "weights": [0.08145920932292938, 0.003315121866762638, 0.24030542373657227, 0.0034980459604412317, 0.0034834302496165037, 0.16299134492874146, 0.003404060145840049, 0.0034867869690060616]}, {"word": "IX-1p", "word_idx": 6, "weights": [0.08820953965187073, 0.14399001002311707, 0.00422912510111928, 0.09592650085687637, 0.004478602670133114, 0.004475735127925873, 0.00422912510111928, 0.00439990172162652]}, {"word": "FINISH", "word_idx": 7, "weights": [0.0013184626586735249, 0.0013184626586735249, 0.0013184626586735249, 0.1313352882862091, 0.0013184626586735249, 0.14886727929115295, 0.14913317561149597, 0.004780622664839029]}, {"word": "JOIN", "word_idx": 8, "weights": [0.00555413169786334, 0.006608393043279648, 0.00555413169786334, 0.1470479518175125, 0.13233929872512817, 0.09560006111860275, 0.00555413169786334, 0.08190114796161652]}, {"word": "IX-1p", "word_idx": 9, "weights": [0.03655996546149254, 0.03403225541114807, 0.27225977182388306, 0.35054582357406616, 0.03655996546149254, 0.27422454953193665, 0.03655996546149254, 0.09239426255226135]}];
211
+ const numGlosses = 10;
212
+ const numFeatures = 8;
213
+
214
+ // Colors for different words (matching matplotlib tab20)
215
+ const colors = [
216
+ '#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd',
217
+ '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf',
218
+ '#aec7e8', '#ffbb78', '#98df8a', '#ff9896', '#c5b0d5',
219
+ '#c49c94', '#f7b6d2', '#c7c7c7', '#dbdb8d', '#9edae5'
220
+ ];
221
+
222
+ // Get controls
223
+ const peakThresholdSlider = document.getElementById('peak-threshold');
224
+ const peakThresholdValue = document.getElementById('peak-threshold-value');
225
+ const confidenceHighSlider = document.getElementById('confidence-high');
226
+ const confidenceHighValue = document.getElementById('confidence-high-value');
227
+ const confidenceMediumSlider = document.getElementById('confidence-medium');
228
+ const confidenceMediumValue = document.getElementById('confidence-medium-value');
229
+ const alignmentCanvas = document.getElementById('alignment-canvas');
230
+ const timelineCanvas = document.getElementById('timeline-canvas');
231
+ const alignmentCtx = alignmentCanvas.getContext('2d');
232
+ const timelineCtx = timelineCanvas.getContext('2d');
233
+
234
+ // Update displays when sliders change
235
+ peakThresholdSlider.oninput = function() {
236
+ peakThresholdValue.textContent = this.value + '%';
237
+ updateVisualization();
238
+ };
239
+
240
+ confidenceHighSlider.oninput = function() {
241
+ confidenceHighValue.textContent = (this.value / 100).toFixed(2);
242
+ updateVisualization();
243
+ };
244
+
245
+ confidenceMediumSlider.oninput = function() {
246
+ confidenceMediumValue.textContent = (this.value / 100).toFixed(2);
247
+ updateVisualization();
248
+ };
249
+
250
+ function resetDefaults() {
251
+ peakThresholdSlider.value = 90;
252
+ confidenceHighSlider.value = 50;
253
+ confidenceMediumSlider.value = 20;
254
+ peakThresholdValue.textContent = '90%';
255
+ confidenceHighValue.textContent = '0.50';
256
+ confidenceMediumValue.textContent = '0.20';
257
+ updateVisualization();
258
+ }
259
+
260
+ function calculateAlignment(weights, peakThreshold) {
261
+ // Find peak
262
+ let peakIdx = 0;
263
+ let peakWeight = weights[0];
264
+ for (let i = 1; i < weights.length; i++) {
265
+ if (weights[i] > peakWeight) {
266
+ peakWeight = weights[i];
267
+ peakIdx = i;
268
+ }
269
+ }
270
+
271
+ // Find significant frames
272
+ const threshold = peakWeight * (peakThreshold / 100);
273
+ let startIdx = peakIdx;
274
+ let endIdx = peakIdx;
275
+ let sumWeight = 0;
276
+ let count = 0;
277
+
278
+ for (let i = 0; i < weights.length; i++) {
279
+ if (weights[i] >= threshold) {
280
+ if (i < startIdx) startIdx = i;
281
+ if (i > endIdx) endIdx = i;
282
+ sumWeight += weights[i];
283
+ count++;
284
+ }
285
+ }
286
+
287
+ const avgWeight = count > 0 ? sumWeight / count : peakWeight;
288
+
289
+ return {
290
+ startIdx: startIdx,
291
+ endIdx: endIdx,
292
+ peakIdx: peakIdx,
293
+ peakWeight: peakWeight,
294
+ avgWeight: avgWeight,
295
+ threshold: threshold
296
+ };
297
+ }
298
+
299
+ function getConfidenceLevel(avgWeight, highThreshold, mediumThreshold) {
300
+ if (avgWeight > highThreshold) return 'high';
301
+ if (avgWeight > mediumThreshold) return 'medium';
302
+ return 'low';
303
+ }
304
+
305
+ function drawAlignmentChart() {
306
+ const peakThreshold = parseInt(peakThresholdSlider.value);
307
+ const highThreshold = parseInt(confidenceHighSlider.value) / 100;
308
+ const mediumThreshold = parseInt(confidenceMediumSlider.value) / 100;
309
+
310
+ // Canvas dimensions
311
+ const width = alignmentCanvas.width;
312
+ const height = alignmentCanvas.height;
313
+ const leftMargin = 180;
314
+ const rightMargin = 50;
315
+ const topMargin = 60;
316
+ const bottomMargin = 80;
317
+
318
+ const plotWidth = width - leftMargin - rightMargin;
319
+ const plotHeight = height - topMargin - bottomMargin;
320
+
321
+ const rowHeight = plotHeight / numGlosses;
322
+ const featureWidth = plotWidth / numFeatures;
323
+
324
+ // Clear canvas
325
+ alignmentCtx.clearRect(0, 0, width, height);
326
+
327
+ // Draw title
328
+ alignmentCtx.fillStyle = '#333';
329
+ alignmentCtx.font = 'bold 18px Arial';
330
+ alignmentCtx.textAlign = 'center';
331
+ alignmentCtx.fillText('Word-to-Frame Alignment', width / 2, 30);
332
+ alignmentCtx.font = '13px Arial';
333
+ alignmentCtx.fillText('(based on attention peaks, ★ = peak frame)', width / 2, 48);
334
+
335
+ // Calculate alignments
336
+ const alignments = [];
337
+ for (let wordIdx = 0; wordIdx < numGlosses; wordIdx++) {
338
+ const data = attentionData[wordIdx];
339
+ const alignment = calculateAlignment(data.weights, peakThreshold);
340
+ alignment.word = data.word;
341
+ alignment.wordIdx = wordIdx;
342
+ alignment.weights = data.weights;
343
+ alignments.push(alignment);
344
+ }
345
+
346
+ // Draw grid
347
+ alignmentCtx.strokeStyle = '#e0e0e0';
348
+ alignmentCtx.lineWidth = 0.5;
349
+ for (let i = 0; i <= numFeatures; i++) {
350
+ const x = leftMargin + i * featureWidth;
351
+ alignmentCtx.beginPath();
352
+ alignmentCtx.moveTo(x, topMargin);
353
+ alignmentCtx.lineTo(x, topMargin + plotHeight);
354
+ alignmentCtx.stroke();
355
+ }
356
+
357
+ // Draw word regions
358
+ for (let wordIdx = 0; wordIdx < numGlosses; wordIdx++) {
359
+ const alignment = alignments[wordIdx];
360
+ const confidence = getConfidenceLevel(alignment.avgWeight, highThreshold, mediumThreshold);
361
+ const y = topMargin + wordIdx * rowHeight;
362
+
363
+ // Alpha based on confidence
364
+ const alpha = confidence === 'high' ? 0.9 : confidence === 'medium' ? 0.7 : 0.5;
365
+
366
+ // Draw rectangle for word region
367
+ const startX = leftMargin + alignment.startIdx * featureWidth;
368
+ const rectWidth = (alignment.endIdx - alignment.startIdx + 1) * featureWidth;
369
+
370
+ alignmentCtx.fillStyle = colors[wordIdx % 20];
371
+ alignmentCtx.globalAlpha = alpha;
372
+ alignmentCtx.fillRect(startX, y, rectWidth, rowHeight * 0.8);
373
+ alignmentCtx.globalAlpha = 1.0;
374
+
375
+ // Draw border
376
+ alignmentCtx.strokeStyle = '#000';
377
+ alignmentCtx.lineWidth = 2;
378
+ alignmentCtx.strokeRect(startX, y, rectWidth, rowHeight * 0.8);
379
+
380
+ // Draw attention waveform inside rectangle
381
+ alignmentCtx.strokeStyle = 'rgba(0, 0, 255, 0.8)';
382
+ alignmentCtx.lineWidth = 1.5;
383
+ alignmentCtx.beginPath();
384
+ for (let i = alignment.startIdx; i <= alignment.endIdx; i++) {
385
+ const x = leftMargin + i * featureWidth + featureWidth / 2;
386
+ const weight = alignment.weights[i];
387
+ const maxWeight = alignment.peakWeight;
388
+ const normalizedWeight = weight / (maxWeight * 1.2); // Scale for visibility
389
+ const waveY = y + rowHeight * 0.8 - (normalizedWeight * rowHeight * 0.6);
390
+
391
+ if (i === alignment.startIdx) {
392
+ alignmentCtx.moveTo(x, waveY);
393
+ } else {
394
+ alignmentCtx.lineTo(x, waveY);
395
+ }
396
+ }
397
+ alignmentCtx.stroke();
398
+
399
+ // Draw word label
400
+ const labelX = startX + rectWidth / 2;
401
+ const labelY = y + rowHeight * 0.4;
402
+
403
+ alignmentCtx.fillStyle = 'rgba(0, 0, 0, 0.7)';
404
+ alignmentCtx.fillRect(labelX - 60, labelY - 12, 120, 24);
405
+ alignmentCtx.fillStyle = '#fff';
406
+ alignmentCtx.font = 'bold 13px Arial';
407
+ alignmentCtx.textAlign = 'center';
408
+ alignmentCtx.textBaseline = 'middle';
409
+ alignmentCtx.fillText(alignment.word, labelX, labelY);
410
+
411
+ // Mark peak frame with star
412
+ const peakX = leftMargin + alignment.peakIdx * featureWidth + featureWidth / 2;
413
+ const peakY = y + rowHeight * 0.4;
414
+
415
+ // Draw star
416
+ alignmentCtx.fillStyle = '#ff0000';
417
+ alignmentCtx.strokeStyle = '#ffff00';
418
+ alignmentCtx.lineWidth = 1.5;
419
+ alignmentCtx.font = '20px Arial';
420
+ alignmentCtx.textAlign = 'center';
421
+ alignmentCtx.strokeText('★', peakX, peakY);
422
+ alignmentCtx.fillText('★', peakX, peakY);
423
+
424
+ // Y-axis label (word names)
425
+ alignmentCtx.fillStyle = '#333';
426
+ alignmentCtx.font = '12px Arial';
427
+ alignmentCtx.textAlign = 'right';
428
+ alignmentCtx.textBaseline = 'middle';
429
+ alignmentCtx.fillText(alignment.word, leftMargin - 10, y + rowHeight * 0.4);
430
+ }
431
+
432
+ // Draw horizontal grid lines
433
+ alignmentCtx.strokeStyle = '#ccc';
434
+ alignmentCtx.lineWidth = 0.5;
435
+ for (let i = 0; i <= numGlosses; i++) {
436
+ const y = topMargin + i * rowHeight;
437
+ alignmentCtx.beginPath();
438
+ alignmentCtx.moveTo(leftMargin, y);
439
+ alignmentCtx.lineTo(leftMargin + plotWidth, y);
440
+ alignmentCtx.stroke();
441
+ }
442
+
443
+ // Draw axes
444
+ alignmentCtx.strokeStyle = '#000';
445
+ alignmentCtx.lineWidth = 2;
446
+ alignmentCtx.strokeRect(leftMargin, topMargin, plotWidth, plotHeight);
447
+
448
+ // X-axis labels (frame indices)
449
+ alignmentCtx.fillStyle = '#000';
450
+ alignmentCtx.font = '11px Arial';
451
+ alignmentCtx.textAlign = 'center';
452
+ alignmentCtx.textBaseline = 'top';
453
+ for (let i = 0; i < numFeatures; i++) {
454
+ const x = leftMargin + i * featureWidth + featureWidth / 2;
455
+ alignmentCtx.fillText(i.toString(), x, topMargin + plotHeight + 10);
456
+ }
457
+
458
+ // Axis titles
459
+ alignmentCtx.fillStyle = '#333';
460
+ alignmentCtx.font = 'bold 14px Arial';
461
+ alignmentCtx.textAlign = 'center';
462
+ alignmentCtx.fillText('Feature Frame Index', leftMargin + plotWidth / 2, height - 20);
463
+
464
+ alignmentCtx.save();
465
+ alignmentCtx.translate(30, topMargin + plotHeight / 2);
466
+ alignmentCtx.rotate(-Math.PI / 2);
467
+ alignmentCtx.fillText('Generated Word', 0, 0);
468
+ alignmentCtx.restore();
469
+
470
+ return alignments;
471
+ }
472
+
473
+ function drawTimeline(alignments) {
474
+ const highThreshold = parseInt(confidenceHighSlider.value) / 100;
475
+ const mediumThreshold = parseInt(confidenceMediumSlider.value) / 100;
476
+
477
+ const width = timelineCanvas.width;
478
+ const height = timelineCanvas.height;
479
+ const leftMargin = 180;
480
+ const rightMargin = 50;
481
+ const plotWidth = width - leftMargin - rightMargin;
482
+ const featureWidth = plotWidth / numFeatures;
483
+
484
+ // Clear canvas
485
+ timelineCtx.clearRect(0, 0, width, height);
486
+
487
+ // Background bar
488
+ timelineCtx.fillStyle = '#ddd';
489
+ timelineCtx.fillRect(leftMargin, 30, plotWidth, 40);
490
+ timelineCtx.strokeStyle = '#000';
491
+ timelineCtx.lineWidth = 2;
492
+ timelineCtx.strokeRect(leftMargin, 30, plotWidth, 40);
493
+
494
+ // Draw word regions on timeline
495
+ for (let wordIdx = 0; wordIdx < alignments.length; wordIdx++) {
496
+ const alignment = alignments[wordIdx];
497
+ const confidence = getConfidenceLevel(alignment.avgWeight, highThreshold, mediumThreshold);
498
+ const alpha = confidence === 'high' ? 0.9 : confidence === 'medium' ? 0.7 : 0.5;
499
+
500
+ const startX = leftMargin + alignment.startIdx * featureWidth;
501
+ const rectWidth = (alignment.endIdx - alignment.startIdx + 1) * featureWidth;
502
+
503
+ timelineCtx.fillStyle = colors[wordIdx % 20];
504
+ timelineCtx.globalAlpha = alpha;
505
+ timelineCtx.fillRect(startX, 30, rectWidth, 40);
506
+ timelineCtx.globalAlpha = 1.0;
507
+ timelineCtx.strokeStyle = '#000';
508
+ timelineCtx.lineWidth = 0.5;
509
+ timelineCtx.strokeRect(startX, 30, rectWidth, 40);
510
+ }
511
+
512
+ // Title
513
+ timelineCtx.fillStyle = '#333';
514
+ timelineCtx.font = 'bold 13px Arial';
515
+ timelineCtx.textAlign = 'left';
516
+ timelineCtx.fillText('Timeline Progress Bar', leftMargin, 20);
517
+ }
518
+
519
+ function updateDetailsPanel(alignments, highThreshold, mediumThreshold) {
520
+ const panel = document.getElementById('alignment-details');
521
+ let html = '<table style="width: 100%; border-collapse: collapse;">';
522
+ html += '<tr style="background: #f0f0f0; font-weight: bold;">';
523
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Word</th>';
524
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Feature Range</th>';
525
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Peak</th>';
526
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Span</th>';
527
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Avg Attention</th>';
528
+ html += '<th style="padding: 8px; border: 1px solid #ddd;">Confidence</th>';
529
+ html += '</tr>';
530
+
531
+ for (const align of alignments) {
532
+ const confidence = getConfidenceLevel(align.avgWeight, highThreshold, mediumThreshold);
533
+ const span = align.endIdx - align.startIdx + 1;
534
+
535
+ html += '<tr>';
536
+ html += `<td style="padding: 8px; border: 1px solid #ddd;"><strong>${align.word}</strong></td>`;
537
+ html += `<td style="padding: 8px; border: 1px solid #ddd;">${align.startIdx} → ${align.endIdx}</td>`;
538
+ html += `<td style="padding: 8px; border: 1px solid #ddd;">${align.peakIdx}</td>`;
539
+ html += `<td style="padding: 8px; border: 1px solid #ddd;">${span}</td>`;
540
+ html += `<td style="padding: 8px; border: 1px solid #ddd;">${align.avgWeight.toFixed(4)}</td>`;
541
+ html += `<td style="padding: 8px; border: 1px solid #ddd;"><span class="confidence ${confidence}">${confidence}</span></td>`;
542
+ html += '</tr>';
543
+ }
544
+
545
+ html += '</table>';
546
+ panel.innerHTML = html;
547
+ }
548
+
549
+ function updateVisualization() {
550
+ const alignments = drawAlignmentChart();
551
+ drawTimeline(alignments);
552
+ const highThreshold = parseInt(confidenceHighSlider.value) / 100;
553
+ const mediumThreshold = parseInt(confidenceMediumSlider.value) / 100;
554
+ updateDetailsPanel(alignments, highThreshold, mediumThreshold);
555
+ }
556
+
557
+ // Event listeners for sliders
558
+ peakSlider.addEventListener('input', function() {
559
+ peakValue.textContent = peakSlider.value + '%';
560
+ updateVisualization();
561
+ });
562
+
563
+ confidenceHighSlider.addEventListener('input', function() {
564
+ const val = parseInt(confidenceHighSlider.value) / 100;
565
+ confidenceHighValue.textContent = val.toFixed(2);
566
+ updateVisualization();
567
+ });
568
+
569
+ confidenceMediumSlider.addEventListener('input', function() {
570
+ const val = parseInt(confidenceMediumSlider.value) / 100;
571
+ confidenceMediumValue.textContent = val.toFixed(2);
572
+ updateVisualization();
573
+ });
574
+
575
+ // Initial visualization
576
+ updateVisualization();
577
+ </script>
578
+ </body>
579
+ </html>
SignX/detailed_prediction_20251226_235251/sample_000/translation.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ With BPE: <unk> #IF FRIEND GROUP/TOGE@@ TH@@ E@@ R DEPART PARTY IX-1p FINISH JO@@ I@@ N IX-1p
2
+ Clean: <unk> #IF FRIEND GROUP/TOGETHER DEPART PARTY IX-1p FINISH JOIN IX-1p
SignX/eval/attention_analysis.py CHANGED
@@ -681,8 +681,7 @@ class AttentionAnalyzer:
681
  feature_text += f"{'='*20}\n\n"
682
  feature_text += f"Range:\n {feat_start} → {feat_end}\n\n"
683
  feature_text += f"Peak:\n {feat_peak}\n\n"
684
- feature_text += f"Count:\n {feat_end - feat_start + 1} features\n\n"
685
- feature_text += f"Position:\n {(feat_start/self.video_frames)*100:.1f}% - {(feat_end/self.video_frames)*100:.1f}%"
686
 
687
  ax_feature.text(0.5, 0.5, feature_text, fontsize=11, family='monospace',
688
  va='center', ha='center',
 
681
  feature_text += f"{'='*20}\n\n"
682
  feature_text += f"Range:\n {feat_start} → {feat_end}\n\n"
683
  feature_text += f"Peak:\n {feat_peak}\n\n"
684
+ feature_text += f"Count:\n {feat_end - feat_start + 1} features"
 
685
 
686
  ax_feature.text(0.5, 0.5, feature_text, fontsize=11, family='monospace',
687
  va='center', ha='center',