Lukas Braach
commited on
Commit
•
b0c88e0
1
Parent(s):
c235442
use numpy
Browse files
rwth_phoenix_weather_2014.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from typing import List, Dict
|
2 |
|
3 |
-
import
|
|
|
4 |
import datasets
|
5 |
import pandas as pd
|
6 |
from datasets.download.streaming_download_manager import ArchiveIterable
|
@@ -39,6 +40,11 @@ _HOMEPAGE = "https://www-i6.informatik.rwth-aachen.de/~koller/RWTH-PHOENIX/"
|
|
39 |
|
40 |
_LICENSE = "CC BY-NC 4.0"
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
class RWTHPhoenixWeather2014Config(datasets.BuilderConfig):
|
44 |
"""BuilderConfig for RWTHPhoenixWeather2014Config."""
|
@@ -179,7 +185,7 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
|
|
179 |
|
180 |
if self.config.name != 'pre-training':
|
181 |
result["frames"] = [
|
182 |
-
|
183 |
]
|
184 |
|
185 |
yield key, result
|
|
|
1 |
from typing import List, Dict
|
2 |
|
3 |
+
from PIL import Image
|
4 |
+
import numpy as np
|
5 |
import datasets
|
6 |
import pandas as pd
|
7 |
from datasets.download.streaming_download_manager import ArchiveIterable
|
|
|
40 |
|
41 |
_LICENSE = "CC BY-NC 4.0"
|
42 |
|
43 |
+
# Function to convert image file to numpy array
|
44 |
+
def image_to_numpy(file):
|
45 |
+
image = Image.open(file)
|
46 |
+
return np.array(image)
|
47 |
+
|
48 |
|
49 |
class RWTHPhoenixWeather2014Config(datasets.BuilderConfig):
|
50 |
"""BuilderConfig for RWTHPhoenixWeather2014Config."""
|
|
|
185 |
|
186 |
if self.config.name != 'pre-training':
|
187 |
result["frames"] = [
|
188 |
+
image_to_numpy(im) for p, im in frames
|
189 |
]
|
190 |
|
191 |
yield key, result
|