Update README.md
Browse files
README.md
CHANGED
@@ -25,6 +25,7 @@ The dataset is organized into the following folders:
|
|
25 |
- `jsons3`: Contains the JSON files corresponding to the images in the `images3` folder.
|
26 |
|
27 |
- **QA Files**
|
|
|
28 |
- `qa`: Contains the QA files corresponding to the images in the `images` folder.
|
29 |
- `qa2`: Contains the QA files corresponding to the images in the `images2` folder.
|
30 |
- `qa3`: Contains the QA files corresponding to the images in the `images3` folder.
|
@@ -32,11 +33,12 @@ The dataset is organized into the following folders:
|
|
32 |
### File Details
|
33 |
|
34 |
- **Images**: JPEG files named in the format `PMCxxxxxx_abc.jpg`, where `xxxxxx` represents the PubMed Central ID and `abc` represents an identifier specific to the image.
|
35 |
-
- **JSON Files**: JSON files named in the same format as the images.
|
|
|
36 |
|
37 |
-
####
|
38 |
|
39 |
-
Each
|
40 |
|
41 |
```json
|
42 |
[
|
@@ -61,8 +63,6 @@ Each JSON file contains a list of question blocks in the following format:
|
|
61 |
]
|
62 |
```
|
63 |
|
64 |
-
- **QA Files**: Contain additional question-answer metadata relevant to the dataset.
|
65 |
-
|
66 |
### Dataset Loader
|
67 |
|
68 |
To facilitate loading and using the dataset, we provide a custom dataset loader script, `dataset.py`. This script defines a PyTorch `Dataset` class to handle loading, preprocessing, and batching of the images and question-answer pairs.
|
@@ -85,22 +85,20 @@ To facilitate loading and using the dataset, we provide a custom dataset loader
|
|
85 |
from dataset import RQADataset
|
86 |
from torch.utils.data import DataLoader
|
87 |
|
88 |
-
#
|
89 |
-
class DataConfig:
|
90 |
-
img_dir = '/home/jupyter/data/RQA/images' # Update with actual image directory path
|
91 |
-
json_dir = '/home/jupyter/data/RQA/jsons' # Update with actual JSON directory path
|
92 |
-
filter_list = '/home/jupyter/data/RQA_V0/test_filenames.txt' # Path to the file containing test filenames
|
93 |
-
train = False # Set to True for training, False for testing
|
94 |
|
95 |
-
|
96 |
-
|
|
|
|
|
97 |
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
104 |
```
|
105 |
|
106 |
### Citation
|
|
|
25 |
- `jsons3`: Contains the JSON files corresponding to the images in the `images3` folder.
|
26 |
|
27 |
- **QA Files**
|
28 |
+
These are the QA created in our proposed dataset.
|
29 |
- `qa`: Contains the QA files corresponding to the images in the `images` folder.
|
30 |
- `qa2`: Contains the QA files corresponding to the images in the `images2` folder.
|
31 |
- `qa3`: Contains the QA files corresponding to the images in the `images3` folder.
|
|
|
33 |
### File Details
|
34 |
|
35 |
- **Images**: JPEG files named in the format `PMCxxxxxx_abc.jpg`, where `xxxxxx` represents the PubMed Central ID and `abc` represents an identifier specific to the image.
|
36 |
+
- **JSON Files**: JSON files named in the same format as the images. These are groundtruth annotations from the https://chartinfo.github.io challenge, they provide annotations for chart type, text(OCR), text location, text type (axis/tick/legend), data used to plot the chart.
|
37 |
+
- **QA Files**: QA files named in the same format as the images. Each QA file is a list of question blocks associated with the corresponding image we created in our proposed dataset.
|
38 |
|
39 |
+
#### QA Structure
|
40 |
|
41 |
+
Each QA file contains a list of question blocks in the following format:
|
42 |
|
43 |
```json
|
44 |
[
|
|
|
63 |
]
|
64 |
```
|
65 |
|
|
|
|
|
66 |
### Dataset Loader
|
67 |
|
68 |
To facilitate loading and using the dataset, we provide a custom dataset loader script, `dataset.py`. This script defines a PyTorch `Dataset` class to handle loading, preprocessing, and batching of the images and question-answer pairs.
|
|
|
85 |
from dataset import RQADataset
|
86 |
from torch.utils.data import DataLoader
|
87 |
|
88 |
+
dataset = RQADataset(data_dir='.', split='train') # split='test' for RQA9357 split used in the paper
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
+
# Test loading a single item
|
91 |
+
print(f"Number of samples in dataset: {len(dataset)}")
|
92 |
+
sample = dataset[0]
|
93 |
+
print("Sample data:", sample)
|
94 |
|
95 |
+
# Initialize DataLoader
|
96 |
+
dataloader = DataLoader(dataset, batch_size=4, collate_fn=RQADataset.custom_collate)
|
97 |
|
98 |
+
# Test DataLoader
|
99 |
+
for batch in dataloader:
|
100 |
+
print("Batch data:", batch)
|
101 |
+
break # Load only one batch for testing
|
102 |
```
|
103 |
|
104 |
### Citation
|