work on what_is_it func;

This commit is contained in:
Angelika Iskra 2022-05-26 23:34:46 +02:00
parent 5c1a1605b8
commit 36f20d8895
6 changed files with 13 additions and 11 deletions

View File

@ -4,7 +4,6 @@ import torch.nn as nn
from torch.optim import SGD, Adam, lr_scheduler
import torch.nn.functional as F
from torch.utils.data import DataLoader
from watersandtreegrass import WaterSandTreeGrass
from common.constants import DEVICE, BATCH_SIZE, NUM_EPOCHS, LEARNING_RATE, SETUP_PHOTOS, ID_TO_CLASS

View File

@ -1,9 +1,9 @@
import torch
import common.helpers
from algorithms.neural_network.neural_network import NeuralNetwork
from algorithms.neural_network.watersandtreegrass import WaterSandTreeGrass
from common.constants import DEVICE, BATCH_SIZE, NUM_EPOCHS, LEARNING_RATE, SETUP_PHOTOS, ID_TO_CLASS
from watersandtreegrass import WaterSandTreeGrass
from torch.utils.data import DataLoader
from neural_network import NeuralNetwork
from torchvision.io import read_image, ImageReadMode
import torch.nn as nn
from torch.optim import Adam
@ -100,7 +100,7 @@ def what_is_it(img_path, show_img=False):
plt.imshow(plt.imread(img_path))
plt.show()
image = SETUP_PHOTOS(image).unsqueeze(0)
model = NeuralNetwork.load_from_checkpoint('./lightning_logs/version_13/checkpoints/epoch=4-step=405.ckpt')
model = NeuralNetwork.load_from_checkpoint('./lightning_logs/version_0/checkpoints/epoch=4-step=405.ckpt')
with torch.no_grad():
model.eval()

View File

@ -6,7 +6,7 @@ GAME_TITLE = 'WMICraft'
WINDOW_HEIGHT = 800
WINDOW_WIDTH = 1360
FPS_COUNT = 60
TURN_INTERVAL = 300
TURN_INTERVAL = 500
GRID_CELL_PADDING = 5
GRID_CELL_SIZE = 36

View File

@ -61,8 +61,8 @@ class Game:
if event.key == pygame.K_n:
print_numbers_flag = not print_numbers_flag
if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds
level.handle_turn()
# if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds
# level.handle_turn()
stats.update()
logs.draw()

View File

@ -3,6 +3,7 @@ import random
import pygame
from algorithms.a_star import a_star, State, TURN_RIGHT, TURN_LEFT, FORWARD
from algorithms.neural_network.neural_network_interface import what_is_it
from common.constants import *
from learning.decision_tree import DecisionTree
from logic.knights_queue import KnightsQueue
@ -31,10 +32,12 @@ class Level:
self.knights_queue = None
def create_map(self):
self.generate_map()
self.setup_base_tiles()
self.setup_objects()
self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red)
print("Create map")
print(what_is_it('../../resources/textures/grass1.png'))
# self.generate_map()
# self.setup_base_tiles()
# self.setup_objects()
# self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red)
def generate_map(self):
spawner = Spawner(self.map)

Binary file not shown.