yhcao's picture
Update README.md
79855f2 verified
metadata
license: cc-by-nc-4.0
dataset_info:
  features:
    - name: image
      dtype: string
    - name: label
      dtype: string
  splits:
    - name: train
      num_bytes: 17286021131
      num_examples: 405055
  download_size: 17266005314
  dataset_size: 17286021131
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*

Install datasets package

First, make sure you have the datasets library installed. If not, you can install it using:

pip install datasets

Load Dataset from Arrow File

Download all arrow files to local_path. The follow is how to load arrow files and decode image:

from datasets import load_from_disk
from io import BytesIO
import base64
from PIL import Image
import mmengine


# Path to your Arrow dataset directory
arrow_dataset_path = 'path_to_your_arrow_dataset_directory'

# Load the dataset
dataset = load_from_disk(arrow_dataset_path)
cat_tree = mmengine.load('v3det_2023_v1_category_tree.json')

# Each dataset entry is composed of an image in the format of base64 string and its corresponding imagenet label id
# Here is an example of how to decode image, and convert imagenet label id to v3det class name
# You can download v3det_2023_v1_category_tree.json here: https://v3det.openxlab.org.cn/download
image = Image.open(BytesIO(base64.b64decode(dataset[0]['image'])))
cat_name = cat_tree['id2name'][dataset[0]['label']]