vivianchen98 commited on
Commit
434a74e
·
verified ·
1 Parent(s): a4fa488

Delete dataset_details.ipynb

Browse files
Files changed (1) hide show
  1. dataset_details.ipynb +0 -168
dataset_details.ipynb DELETED
@@ -1,168 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 32,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import pandas as pd\n",
10
- "import os\n",
11
- "from tqdm import tqdm"
12
- ]
13
- },
14
- {
15
- "cell_type": "code",
16
- "execution_count": 33,
17
- "metadata": {},
18
- "outputs": [
19
- {
20
- "name": "stdout",
21
- "output_type": "stream",
22
- "text": [
23
- "Total number of papers in the dataset: 2556\n"
24
- ]
25
- }
26
- ],
27
- "source": [
28
- "# Load the dataset\n",
29
- "iclr2024_df = pd.read_json('/nas/pohan/datasets/AIConfVideo/dataset/pruned_paperlist_iclr2024.json')\n",
30
- "iclr2024_df['venue'] = 'iclr2024'\n",
31
- "\n",
32
- "nips2024_df = pd.read_json('/nas/pohan/datasets/AIConfVideo/dataset/pruned_paperlist_nips2024.json')\n",
33
- "nips2024_df['venue'] = 'nips2024'\n",
34
- "\n",
35
- "combined_df = pd.concat([iclr2024_df, nips2024_df], ignore_index=True)\n",
36
- "print(f\"Total number of papers in the dataset: {len(combined_df)}\")"
37
- ]
38
- },
39
- {
40
- "cell_type": "code",
41
- "execution_count": 36,
42
- "metadata": {},
43
- "outputs": [
44
- {
45
- "name": "stderr",
46
- "output_type": "stream",
47
- "text": [
48
- "Validating videos: 100%|██████████| 2556/2556 [00:18<00:00, 141.50it/s]"
49
- ]
50
- },
51
- {
52
- "name": "stdout",
53
- "output_type": "stream",
54
- "text": [
55
- "Total number of papers in the dataset: 2287\n"
56
- ]
57
- },
58
- {
59
- "name": "stderr",
60
- "output_type": "stream",
61
- "text": [
62
- "\n"
63
- ]
64
- }
65
- ],
66
- "source": [
67
- "# Filter out rows with missing required fields\n",
68
- "valid_rows = combined_df.dropna(subset=['openreview_id', 'slideslive_id', 'tldr', 'primary_area'])\n",
69
- "\n",
70
- "final_dataset_df = pd.DataFrame()\n",
71
- "\n",
72
- "# Check the validity of each corresponding video with progress bar\n",
73
- "for i, row in tqdm(valid_rows.iterrows(), total=len(valid_rows), desc=\"Validating videos\"):\n",
74
- " slideslive_id = row['slideslive_id']\n",
75
- " video_dir = f\"/nas/pohan/datasets/AIConfVideo/video/{slideslive_id}\"\n",
76
- " \n",
77
- " # Check if files exist and are not empty\n",
78
- " video_path = os.path.join(video_dir, 'video.mp4')\n",
79
- " slide_path = os.path.join(video_dir, 'slide_1.png')\n",
80
- " \n",
81
- " if (os.path.exists(video_path) and os.path.getsize(video_path) > 0 and\n",
82
- " os.path.exists(slide_path) and os.path.getsize(slide_path) > 0):\n",
83
- " final_dataset_df = pd.concat([final_dataset_df, pd.DataFrame([row])], ignore_index=True)\n",
84
- "\n",
85
- "# Display a sample of the dataset\n",
86
- "final_dataset_df.head()\n",
87
- "# Print basic statistics about the dataset\n",
88
- "print(f\"Total number of papers in the dataset: {len(final_dataset_df)}\")"
89
- ]
90
- },
91
- {
92
- "cell_type": "code",
93
- "execution_count": 38,
94
- "metadata": {},
95
- "outputs": [
96
- {
97
- "name": "stdout",
98
- "output_type": "stream",
99
- "text": [
100
- "Dataset saved to /nas/pohan/datasets/AIConfVideo/learningpaper24/catalog.json\n"
101
- ]
102
- }
103
- ],
104
- "source": [
105
- "# to_save_df = final_dataset_df[['openreview_id', 'slideslive_id', 'venue', 'title', 'status', 'keywords', 'tldr', 'abstract', 'primary_area', 'site']]\n",
106
- "\n",
107
- "# # Save to a new JSON file\n",
108
- "# output_dir = '/nas/pohan/datasets/AIConfVideo/learningpaper24'\n",
109
- "# os.makedirs(output_dir, exist_ok=True)\n",
110
- "# output_path = os.path.join(output_dir, 'catalog.json')\n",
111
- "\n",
112
- "# to_save_df.to_json(output_path, orient='records', indent=4)\n",
113
- "# print(f\"Dataset saved to {output_path}\")"
114
- ]
115
- },
116
- {
117
- "cell_type": "code",
118
- "execution_count": 51,
119
- "metadata": {},
120
- "outputs": [],
121
- "source": [
122
- "# catalog_df = pd.read_json(\"/nas/pohan/datasets/AIConfVideo/learningpaper24/metadata/catalog.json\")\n",
123
- "# catalog_df = catalog_df[['video_file'] + list(catalog_df.columns.drop('video_file'))]\n",
124
- "\n",
125
- "# catalog_df.to_json(\"/nas/pohan/datasets/AIConfVideo/learningpaper24/metadata/catalog.json\", orient='records', indent=4)"
126
- ]
127
- },
128
- {
129
- "cell_type": "code",
130
- "execution_count": 52,
131
- "metadata": {},
132
- "outputs": [],
133
- "source": [
134
- "# import json\n",
135
- "\n",
136
- "# # Load the JSON file\n",
137
- "# with open('/nas/pohan/datasets/AIConfVideo/learningpaper24/metadata/catalog.json', 'r') as f:\n",
138
- "# data = json.load(f) # should be a list of dicts\n",
139
- "\n",
140
- "# # Write out JSONL\n",
141
- "# with open('/nas/pohan/datasets/AIConfVideo/learningpaper24/metadata/catalog.jsonl', 'w') as f:\n",
142
- "# for entry in data:\n",
143
- "# f.write(json.dumps(entry) + '\\n')\n"
144
- ]
145
- }
146
- ],
147
- "metadata": {
148
- "kernelspec": {
149
- "display_name": "tldr",
150
- "language": "python",
151
- "name": "python3"
152
- },
153
- "language_info": {
154
- "codemirror_mode": {
155
- "name": "ipython",
156
- "version": 3
157
- },
158
- "file_extension": ".py",
159
- "mimetype": "text/x-python",
160
- "name": "python",
161
- "nbconvert_exporter": "python",
162
- "pygments_lexer": "ipython3",
163
- "version": "3.10.16"
164
- }
165
- },
166
- "nbformat": 4,
167
- "nbformat_minor": 2
168
- }