qgyd2021 commited on
Commit
1b4f577
1 Parent(s): eeff54e

[update]add data

Browse files
Files changed (2) hide show
  1. cppe5.py +5 -2
  2. main.py +2 -2
cppe5.py CHANGED
@@ -6,6 +6,7 @@ import os
6
  from pathlib import Path
7
 
8
  import datasets
 
9
 
10
  # _URL = "https://drive.google.com/uc?id=1MGnaAfbckUmigGUvihz7uiHGC6rBIbvr"
11
 
@@ -99,11 +100,13 @@ class CPPE5(datasets.GeneratorBasedBuilder):
99
  file_path = dl_manager.download(file_path)
100
 
101
  with open(file_path, "rb") as image_f:
102
- image_bytes = image_f.read()
 
103
 
104
  yield idx, {
105
  "image_id": sample["image_id"],
106
- "image": {"path": file_path, "bytes": image_bytes},
 
107
  "width": sample["width"],
108
  "height": sample["height"],
109
  "objects": sample["objects"],
 
6
  from pathlib import Path
7
 
8
  import datasets
9
+ from PIL import Image
10
 
11
  # _URL = "https://drive.google.com/uc?id=1MGnaAfbckUmigGUvihz7uiHGC6rBIbvr"
12
 
 
100
  file_path = dl_manager.download(file_path)
101
 
102
  with open(file_path, "rb") as image_f:
103
+ # image_bytes = image_f.read()
104
+ image = Image.open(image_f)
105
 
106
  yield idx, {
107
  "image_id": sample["image_id"],
108
+ # "image": {"path": file_path, "bytes": image_bytes},
109
+ "image": image,
110
  "width": sample["width"],
111
  "height": sample["height"],
112
  "objects": sample["objects"],
main.py CHANGED
@@ -3,8 +3,8 @@
3
  from datasets import load_dataset
4
 
5
  dataset = load_dataset(
6
- "qgyd2021/cppe-5",
7
- # "cppe5.py",
8
  name=None,
9
  split="train",
10
  )
 
3
  from datasets import load_dataset
4
 
5
  dataset = load_dataset(
6
+ # "qgyd2021/cppe-5",
7
+ "cppe5.py",
8
  name=None,
9
  split="train",
10
  )