|
--- |
|
task_categories: |
|
- visual-question-answering |
|
language: |
|
- en |
|
pretty_name: Scientific Figures and Captions |
|
size_categories: |
|
- 1M<n<10M |
|
--- |
|
# Scientific Figures and Captions Dataset from research papers |
|
|
|
This repository contains the Scientific Figures and Captions dataset, which includes approximately 4.2 million entries of scientific figures and their corresponding captions extracted from academic papers on arXiv. This dataset is intended for research purposes in the fields of computer vision and natural language processing, particularly for tasks related to image captioning and automated figure analysis. |
|
|
|
## Dataset Description |
|
|
|
The dataset is structured as a Parquet dataframe with two columns: |
|
- `image_filename`: This column contains the relative paths to image files. |
|
- `caption`: This column contains the textual captions associated with each image. |
|
|
|
Images are stored under `dataset/figures/` and are compressed into multiple parts (.z01, .z02, ..., .z103) with a final `.zip` file that encompasses all parts. This format is used for efficiently handling large datasets. |
|
|
|
## Extraction Instructions |
|
|
|
To access the images, you must first decompress the multi-part ZIP archive. Make sure you have all parts of the archive (.z01 to .z103 and the .zip file) in the same directory. Most decompression tools will recognize and handle multi-part ZIP files seamlessly. |
|
|
|
Here is an example using the command line with `unzip`: |
|
```bash |
|
# Navigate to the directory containing the compressed parts |
|
cd dataset/figures |
|
|
|
# Use unzip to extract the first set of images |
|
unzip compressedfigures.zip |
|
|
|
# combine the second set of images |
|
cat compressedfigures_part2* > compressedfigures_part2.tar.gz |
|
# unzip second set of images |
|
tar xf compressedfigures_part2.tar.gz |
|
|
|
# You're good to go! |
|
|
|
``` |
|
|
|
This will extract the contents into the `dataset/figures/` directory. Ensure that you have enough storage space to accommodate the uncompressed images. |
|
|
|
## Usage Example |
|
|
|
To use the dataset in your Python projects, you'll need to read the Parquet file into a DataFrame. Here is an example using `pandas`: |
|
```python |
|
import pandas as pd |
|
|
|
# Load the dataset into a DataFrame |
|
df = pd.read_parquet('dataset.parquet') |
|
|
|
# Display the first few entries |
|
df.head() |
|
``` |
|
|
|
Once the dataset is loaded, you can use it as follows: |
|
```python |
|
from PIL import Image |
|
import matplotlib.pyplot as plt |
|
|
|
# Example function to display an image with its caption |
|
def show_image_with_caption(image_path, caption): |
|
img = Image.open(image_path) |
|
plt.imshow(img) |
|
plt.title(caption) |
|
plt.axis('off') # Hide the axis |
|
plt.show() |
|
|
|
# Display the first image and its caption |
|
first_image_path = df.loc[0, 'image_filename'] |
|
first_caption = df.loc[0, 'caption'] |
|
show_image_with_caption(first_image_path, first_caption) |
|
``` |
|
|
|
## Acknowledgment |
|
|
|
Special thanks to arxiv for providing access to all of the research papers. |