Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .DS_Store +0 -0
- MTabVQA-Query-Eval-categories.jsonl +0 -0
- analysis_plot.png +3 -0
- script.py +96 -0
- table_images/TableImg_060y7_11.png +3 -0
- table_images/TableImg_0r2qp_10.png +3 -0
- table_images/TableImg_0sahy_15.png +3 -0
- table_images/TableImg_1i3o6_13.png +3 -0
- table_images/TableImg_1wlgj_15.png +3 -0
- table_images/TableImg_25fur_6.png +3 -0
- table_images/TableImg_2afwy_14.png +3 -0
- table_images/TableImg_2tvmm_8.png +3 -0
- table_images/TableImg_3czqw_8.png +3 -0
- table_images/TableImg_3d7tc_9.png +3 -0
- table_images/TableImg_3k3zr_34.png +3 -0
- table_images/TableImg_46qix_500.png +3 -0
- table_images/TableImg_49hed_4.png +3 -0
- table_images/TableImg_4awov_8.png +3 -0
- table_images/TableImg_4pop0_4.png +3 -0
- table_images/TableImg_4qf2w_15.png +3 -0
- table_images/TableImg_4vrc9_15.png +3 -0
- table_images/TableImg_504ma_4.png +3 -0
- table_images/TableImg_580of_10.png +3 -0
- table_images/TableImg_5dt30_4.png +3 -0
- table_images/TableImg_5uet9_3.png +3 -0
- table_images/TableImg_5v6b7_6.png +3 -0
- table_images/TableImg_60okw_15.png +3 -0
- table_images/TableImg_61s34_15.png +3 -0
- table_images/TableImg_6olbg_15.png +3 -0
- table_images/TableImg_6t05l_6.png +3 -0
- table_images/TableImg_70242_4.png +3 -0
- table_images/TableImg_76za5_6.png +3 -0
- table_images/TableImg_87en9_15.png +3 -0
- table_images/TableImg_8xrs4_14.png +3 -0
- table_images/TableImg_9bwfc_15.png +3 -0
- table_images/TableImg_9f1vj_27.png +3 -0
- table_images/TableImg_A7mn4_76.png +3 -0
- table_images/TableImg_Abcsl_9.png +3 -0
- table_images/TableImg_Anw9u_15.png +3 -0
- table_images/TableImg_Aoctm_6.png +3 -0
- table_images/TableImg_B1o1r_40.png +3 -0
- table_images/TableImg_B9bp3_15.png +3 -0
- table_images/TableImg_Bft1m_57.png +3 -0
- table_images/TableImg_Boop1_6.png +3 -0
- table_images/TableImg_Bsi98_7.png +3 -0
- table_images/TableImg_C01dq_8.png +3 -0
- table_images/TableImg_C2bys_34.png +3 -0
- table_images/TableImg_C7aam_6.png +3 -0
- table_images/TableImg_C7qup_12.png +3 -0
- table_images/TableImg_Ce0kg_14.png +3 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
MTabVQA-Query-Eval-categories.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
analysis_plot.png
ADDED
|
Git LFS Details
|
script.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import sys
|
| 3 |
+
from collections import Counter
|
| 4 |
+
|
| 5 |
+
input_filename = 'mtabvqa_query.jsonl' # Changed to mtabqa_query.jsonl
|
| 6 |
+
output_filename = 'mtabqa_query_filtered.jsonl'
|
| 7 |
+
removed_filename = 'mtabqa_query_removed_one_table.jsonl'
|
| 8 |
+
|
| 9 |
+
print(f"Starting analysis of '{input_filename}'...")
|
| 10 |
+
|
| 11 |
+
try:
|
| 12 |
+
with open(input_filename, 'r', encoding='utf-8') as infile, \
|
| 13 |
+
open(output_filename, 'w', encoding='utf-8') as outfile, \
|
| 14 |
+
open(removed_filename, 'w', encoding='utf-8') as removed_file:
|
| 15 |
+
|
| 16 |
+
# Counters for statistics
|
| 17 |
+
tables_count = Counter()
|
| 18 |
+
kept_count = 0
|
| 19 |
+
removed_count = 0
|
| 20 |
+
error_count = 0
|
| 21 |
+
skipped_lines = []
|
| 22 |
+
|
| 23 |
+
for line_num, line in enumerate(infile, 1):
|
| 24 |
+
try:
|
| 25 |
+
# Remove potential leading/trailing whitespace
|
| 26 |
+
stripped_line = line.strip()
|
| 27 |
+
if not stripped_line: # Skip empty lines
|
| 28 |
+
print(f"Warning: Skipping empty line {line_num}.", file=sys.stderr)
|
| 29 |
+
skipped_lines.append(line_num)
|
| 30 |
+
continue
|
| 31 |
+
|
| 32 |
+
data = json.loads(stripped_line)
|
| 33 |
+
|
| 34 |
+
# Check if 'table_image_ids' key exists and is a list
|
| 35 |
+
if 'table_image_ids' in data and isinstance(data.get('table_image_ids'), list):
|
| 36 |
+
num_tables = len(data['table_image_ids'])
|
| 37 |
+
|
| 38 |
+
# Update our counter
|
| 39 |
+
tables_count[num_tables] += 1
|
| 40 |
+
|
| 41 |
+
if num_tables > 1:
|
| 42 |
+
# Keep this line (write to output file)
|
| 43 |
+
outfile.write(stripped_line + '\n')
|
| 44 |
+
kept_count += 1
|
| 45 |
+
elif num_tables == 1:
|
| 46 |
+
# Remove this line (write to removed file)
|
| 47 |
+
removed_file.write(stripped_line + '\n')
|
| 48 |
+
removed_count += 1
|
| 49 |
+
else: # num_tables == 0 or other unexpected cases
|
| 50 |
+
print(f"Info: Line {line_num} has zero tables. Skipping.", file=sys.stderr)
|
| 51 |
+
skipped_lines.append(line_num)
|
| 52 |
+
else:
|
| 53 |
+
# Handle cases where 'table_image_ids' key is missing or not a list
|
| 54 |
+
print(f"Warning: Skipping line {line_num} due to missing or invalid 'table_image_ids' field.", file=sys.stderr)
|
| 55 |
+
error_count += 1
|
| 56 |
+
skipped_lines.append(line_num)
|
| 57 |
+
|
| 58 |
+
except json.JSONDecodeError:
|
| 59 |
+
print(f"Error: Could not decode JSON on line {line_num}. Skipping.", file=sys.stderr)
|
| 60 |
+
error_count += 1
|
| 61 |
+
skipped_lines.append(line_num)
|
| 62 |
+
except Exception as e:
|
| 63 |
+
print(f"An unexpected error occurred processing line {line_num}: {e}", file=sys.stderr)
|
| 64 |
+
error_count += 1
|
| 65 |
+
skipped_lines.append(line_num)
|
| 66 |
+
|
| 67 |
+
# Print distribution of tables per question
|
| 68 |
+
print("\n--- Table Distribution Statistics ---")
|
| 69 |
+
print(f"Total questions processed: {sum(tables_count.values())}")
|
| 70 |
+
|
| 71 |
+
for table_count in sorted(tables_count.keys()):
|
| 72 |
+
count = tables_count[table_count]
|
| 73 |
+
percentage = (count / sum(tables_count.values())) * 100
|
| 74 |
+
print(f"Questions with {table_count} {'tables' if table_count != 1 else 'table'}: {count} ({percentage:.2f}%)")
|
| 75 |
+
|
| 76 |
+
# Additional stats for multi-table questions
|
| 77 |
+
multi_table_count = sum(tables_count[i] for i in tables_count if i > 1)
|
| 78 |
+
multi_table_percentage = (multi_table_count / sum(tables_count.values())) * 100 if sum(tables_count.values()) > 0 else 0
|
| 79 |
+
print(f"\nQuestions with 2+ tables: {multi_table_count} ({multi_table_percentage:.2f}%)")
|
| 80 |
+
|
| 81 |
+
# Print standard summary
|
| 82 |
+
print("\n--- Processing Summary ---")
|
| 83 |
+
print(f"Successfully processed {line_num} lines from '{input_filename}'.")
|
| 84 |
+
print(f"Kept {kept_count} entries (more than one table) in '{output_filename}'.")
|
| 85 |
+
print(f"Removed {removed_count} entries (exactly one table) to '{removed_filename}'.")
|
| 86 |
+
if error_count > 0:
|
| 87 |
+
print(f"Encountered {error_count} errors (JSON decoding or invalid format).")
|
| 88 |
+
print(f"Problematic line numbers: {skipped_lines}")
|
| 89 |
+
print("--------------------------\n")
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
except FileNotFoundError:
|
| 93 |
+
print(f"Error: Input file '{input_filename}' not found in the current directory.", file=sys.stderr)
|
| 94 |
+
print("Please make sure the script is in the same directory as the .jsonl file or update the 'input_filename' variable.", file=sys.stderr)
|
| 95 |
+
except Exception as e:
|
| 96 |
+
print(f"A critical error occurred during file operations: {e}", file=sys.stderr)
|
table_images/TableImg_060y7_11.png
ADDED
|
Git LFS Details
|
table_images/TableImg_0r2qp_10.png
ADDED
|
Git LFS Details
|
table_images/TableImg_0sahy_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_1i3o6_13.png
ADDED
|
Git LFS Details
|
table_images/TableImg_1wlgj_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_25fur_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_2afwy_14.png
ADDED
|
Git LFS Details
|
table_images/TableImg_2tvmm_8.png
ADDED
|
Git LFS Details
|
table_images/TableImg_3czqw_8.png
ADDED
|
Git LFS Details
|
table_images/TableImg_3d7tc_9.png
ADDED
|
Git LFS Details
|
table_images/TableImg_3k3zr_34.png
ADDED
|
Git LFS Details
|
table_images/TableImg_46qix_500.png
ADDED
|
Git LFS Details
|
table_images/TableImg_49hed_4.png
ADDED
|
Git LFS Details
|
table_images/TableImg_4awov_8.png
ADDED
|
Git LFS Details
|
table_images/TableImg_4pop0_4.png
ADDED
|
Git LFS Details
|
table_images/TableImg_4qf2w_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_4vrc9_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_504ma_4.png
ADDED
|
Git LFS Details
|
table_images/TableImg_580of_10.png
ADDED
|
Git LFS Details
|
table_images/TableImg_5dt30_4.png
ADDED
|
Git LFS Details
|
table_images/TableImg_5uet9_3.png
ADDED
|
Git LFS Details
|
table_images/TableImg_5v6b7_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_60okw_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_61s34_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_6olbg_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_6t05l_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_70242_4.png
ADDED
|
Git LFS Details
|
table_images/TableImg_76za5_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_87en9_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_8xrs4_14.png
ADDED
|
Git LFS Details
|
table_images/TableImg_9bwfc_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_9f1vj_27.png
ADDED
|
Git LFS Details
|
table_images/TableImg_A7mn4_76.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Abcsl_9.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Anw9u_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Aoctm_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_B1o1r_40.png
ADDED
|
Git LFS Details
|
table_images/TableImg_B9bp3_15.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Bft1m_57.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Boop1_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Bsi98_7.png
ADDED
|
Git LFS Details
|
table_images/TableImg_C01dq_8.png
ADDED
|
Git LFS Details
|
table_images/TableImg_C2bys_34.png
ADDED
|
Git LFS Details
|
table_images/TableImg_C7aam_6.png
ADDED
|
Git LFS Details
|
table_images/TableImg_C7qup_12.png
ADDED
|
Git LFS Details
|
table_images/TableImg_Ce0kg_14.png
ADDED
|
Git LFS Details
|