Neural_network #4

Merged
s481894 merged 12 commits from Neural_network into master 2024-06-04 16:59:03 +02:00
4 changed files with 16 additions and 2 deletions
Showing only changes of commit fb0ec5057c - Show all commits

View File

@ -52,4 +52,11 @@ def get_tile_coordinates(index):
tile = tiles[index]
return tile.x, tile.y
else:
return None
return None
def get_tile_index():
valid_indices = []
for index, tile in enumerate(tiles):
if tile.image=="resources/images/sampling.png":
valid_indices.append(index)
return random.choice(valid_indices)

View File

@ -1,5 +1,7 @@
import random
import os
import numpy as np
import matplotlib.pyplot as plt
# path to plant images folder (used in randomize_photo function)
folder_path = "resources/images/plant_photos"
@ -48,4 +50,9 @@ class Tile:
self.image = "resources/images/rock_dirt.png"
# DISCLAMER check column and choose plant type ("potato","wheat" etc.)
def displayPhoto(self):
img = self.photo
img = img / 2 + 0.5 # unnormalize
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
plt.show()