Datasets:
Update CUB-200.py
Browse files- CUB-200.py +3 -3
CUB-200.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import os
|
2 |
import datasets
|
3 |
-
from datasets import DatasetInfo, DownloadManager
|
4 |
import pickle
|
5 |
import random
|
6 |
from tqdm import tqdm
|
7 |
-
from PIL import Image
|
8 |
|
9 |
_URLS = {
|
10 |
"train": "train/filenames.pickle",
|
@@ -45,7 +45,7 @@ class CUB200Dataset(datasets.GeneratorBasedBuilder):
|
|
45 |
this_text_path = os.path.join(text_path, name+".txt")
|
46 |
with open(this_text_path, "r") as f:
|
47 |
caption = random.choice(f.readlines()).replace("\n", "").lower()
|
48 |
-
image = Image.
|
49 |
yield index, {
|
50 |
"image": image,
|
51 |
"text": caption,
|
|
|
1 |
import os
|
2 |
import datasets
|
3 |
+
from datasets import DatasetInfo, DownloadManager, Image
|
4 |
import pickle
|
5 |
import random
|
6 |
from tqdm import tqdm
|
7 |
+
#from PIL import Image
|
8 |
|
9 |
_URLS = {
|
10 |
"train": "train/filenames.pickle",
|
|
|
45 |
this_text_path = os.path.join(text_path, name+".txt")
|
46 |
with open(this_text_path, "r") as f:
|
47 |
caption = random.choice(f.readlines()).replace("\n", "").lower()
|
48 |
+
image = Image().encode_example(os.path.join(images_path, name+".jpg"))
|
49 |
yield index, {
|
50 |
"image": image,
|
51 |
"text": caption,
|