Update README.md
Browse files
README.md
CHANGED
@@ -1,20 +1,53 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-4.0
|
3 |
-
dataset_info:
|
4 |
-
features:
|
5 |
-
- name: image
|
6 |
-
dtype: string
|
7 |
-
- name: label
|
8 |
-
dtype: string
|
9 |
-
splits:
|
10 |
-
- name: train
|
11 |
-
num_bytes: 17286021131
|
12 |
-
num_examples: 405055
|
13 |
-
download_size: 17266005314
|
14 |
-
dataset_size: 17286021131
|
15 |
-
configs:
|
16 |
-
- config_name: default
|
17 |
-
data_files:
|
18 |
-
- split: train
|
19 |
-
path: data/train-*
|
20 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
dataset_info:
|
4 |
+
features:
|
5 |
+
- name: image
|
6 |
+
dtype: string
|
7 |
+
- name: label
|
8 |
+
dtype: string
|
9 |
+
splits:
|
10 |
+
- name: train
|
11 |
+
num_bytes: 17286021131
|
12 |
+
num_examples: 405055
|
13 |
+
download_size: 17266005314
|
14 |
+
dataset_size: 17286021131
|
15 |
+
configs:
|
16 |
+
- config_name: default
|
17 |
+
data_files:
|
18 |
+
- split: train
|
19 |
+
path: data/train-*
|
20 |
+
---
|
21 |
+
|
22 |
+
|
23 |
+
### Install datasets package
|
24 |
+
First, make sure you have the datasets library installed. If not, you can install it using:
|
25 |
+
|
26 |
+
```bash
|
27 |
+
pip install datasets
|
28 |
+
```
|
29 |
+
|
30 |
+
### Load Dataset from Arrow File
|
31 |
+
Download all arrow files to local_path. The follow is how to load arrow files and decode image:
|
32 |
+
|
33 |
+
```python
|
34 |
+
from datasets import load_from_disk
|
35 |
+
from io import BytesIO
|
36 |
+
import base64
|
37 |
+
from PIL import Image
|
38 |
+
import mmengine
|
39 |
+
|
40 |
+
|
41 |
+
# Path to your Arrow dataset directory
|
42 |
+
arrow_dataset_path = 'path_to_your_arrow_dataset_directory'
|
43 |
+
|
44 |
+
# Load the dataset
|
45 |
+
dataset = load_from_disk(arrow_dataset_path)
|
46 |
+
cat_tree = mmengine.load('v3det_2023_v1_category_tree.json')
|
47 |
+
|
48 |
+
# Each dataset entry is composed of an image in the format of base64 string and its corresponding imagenet label id
|
49 |
+
# Here is an example of how to decode image, and convert imagenet label id to v3det class name
|
50 |
+
# You can download v3det_2023_v1_category_tree.json here: https://v3det.openxlab.org.cn/download
|
51 |
+
image = Image.open(BytesIO(base64.b64decode(dataset[0]['image'])))
|
52 |
+
cat_name = cat_tree['id2name'][dataset[0]['label']]
|
53 |
+
```
|