Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions task-tfrecords/generate_datanpz.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,22 @@ def make_datanpz(dest_folder, imagery, supertile,
continue

np_image = np.array(img)

if np_image.shape == (256, 256, 2):
print("bad tile: {}".format(tile))

img.close()

if not supertile:
if not supertile and not np_image.shape == (256, 256, 2):
try:
np_image = np_image.reshape((256, 256, 3)) # 4 channels returned from some endpoints, but not all
x_vals.append(np_image)
y_vals.append(labels[tile])
except ValueError:
np_image = np_image.reshape((256, 256, 4))
np_image = np_image[:, :, :3]

#focusing just on classification
x_vals.append(np_image)
y_vals.append(labels[tile])
x_vals.append(np_image)
y_vals.append(labels[tile])

# Convert lists to numpy arrays
x_vals = np.array(x_vals, dtype=np.uint8)
Expand Down