File size: 1,162 Bytes
cddf292 db91132 140f1b5 db91132 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
---
license: mit
language:
- vi
size_categories:
- 100K<n<1M
---
# Structure
Each sample will have a structure as follows:
```
{
'id': Value(dtype='string', id=None),
'images': Value(dtype='binary', id=None),
'conversations': [{'from': Value(dtype='string', id=None), 'value': Value(dtype='string', id=None)}]
}
{
'id': '004309348',
'image': <image-bytes>,
'conversations': [{'from': 'human', 'value': 'Điều gì được minh họa trong hình ảnh này?\n<image>'}, {'from': 'gpt', 'value': 'bạn nghĩ có bao nhiêu sinh viên ở farbaut sử dụng sản phẩm thuốc lá'}]
}
```
# How To Use
## Convert binary objects
Because the returned video will be in bytes, here is a way to extract frames and fps:
```python
import io
import numpy as np
from PIL import Image
from datasets import load_dataset
def extract_image(image_bytes):
img = Image.open(io.BytesIO(image_bytes))
arr = np.asarray(img)
return arr
dataset = load_dataset("Vividbot/instruct500k_vi", name="all", streaming=True)
image_bytes = next(iter(dataset["train"]))["image"]
image = extract_image(image_bytes)
print(f"Image shape: {image.shape}")
``` |