Skip to content

Commit 749d24f

Browse files
committed
path changes
1 parent 74c1dfe commit 749d24f

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed
6.06 KB
Binary file not shown.

src/maps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def generate_patches(self, mapReader, image_groups=3):
7676
for x in range(self.window_size[0])])
7777

7878
if len(self.samples)==self.sample_group_size:
79-
with open("data/output/SF_group"+str(img_group_number)+".dill", 'wb+') as f:
79+
with open("../data/output/city_patches/dill/sf/"+str(img_group_number)+".dill", 'wb+') as f:
8080
dill.dump(self.samples, f)
8181
f.close()
8282
print("Image group {} saved in data/output/ !".format(img_group_number))

src/read.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ def __init__(self, directory_path, location='SF'):
1313

1414
def load_group(self, group=0):
1515
if self.dir_path[-1]=='/':
16-
with open(self.dir_path+self.location+"_group"+str(group)+".dill", 'rb') as d:
16+
with open(self.dir_path+str(group)+".dill", 'rb') as d:
1717
self.data = dill.load(d)
1818
d.close()
1919
else:
2020
self.dir_path = self.dir_path + "/"
21-
with open(self.dir_path+self.location+"_group"+str(group)+".dill", 'rb') as d:
21+
with open(self.dir_path+str(group)+".dill", 'rb') as d:
2222
self.data = dill.load(d)
2323
d.close()
2424

@@ -30,10 +30,14 @@ def read_numpy(self):
3030
self.data = self.data.astype(np.uint8)
3131
return self.data
3232

33-
reader = ImgGroupReader("data/output/")
34-
reader.load_group()
35-
data = reader.read_numpy()
36-
im = Image.fromarray(data[0])
37-
im.show()
33+
sf_groups = 117
34+
for i in range(sf_groups):
35+
reader = ImgGroupReader("../data/output/city_patches/dill/washington")
36+
reader.load_group(group=i)
37+
data = reader.read_numpy()
38+
im = Image.fromarray(data[0])
39+
im.save('../data/output/city_patches/png/washington/'+str(i)+'.png')
40+
41+
3842

3943

src/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
import maps
33

44
sfMap = maps.MapReader('../data/input/sf_layered.txt')
5-
mapsDataset = maps.MapsDataset((32, 32), 2, 1280, maps.single_layer_converter) #Third parameter is the group size
5+
mapsDataset = maps.MapsDataset((64, 64), 2, 1280, maps.single_layer_converter) #Third parameter is the group size
66
mapsDataset.generate_patches(sfMap) #This will generate dill files which contain the saved sample lists.

0 commit comments

Comments
 (0)