work on what_is_it func;
This commit is contained in:
parent
5c1a1605b8
commit
36f20d8895
@ -4,7 +4,6 @@ import torch.nn as nn
|
|||||||
from torch.optim import SGD, Adam, lr_scheduler
|
from torch.optim import SGD, Adam, lr_scheduler
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch.utils.data import DataLoader
|
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
|
from common.constants import DEVICE, BATCH_SIZE, NUM_EPOCHS, LEARNING_RATE, SETUP_PHOTOS, ID_TO_CLASS
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import torch
|
import torch
|
||||||
import common.helpers
|
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 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 torch.utils.data import DataLoader
|
||||||
from neural_network import NeuralNetwork
|
|
||||||
from torchvision.io import read_image, ImageReadMode
|
from torchvision.io import read_image, ImageReadMode
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.optim import Adam
|
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.imshow(plt.imread(img_path))
|
||||||
plt.show()
|
plt.show()
|
||||||
image = SETUP_PHOTOS(image).unsqueeze(0)
|
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():
|
with torch.no_grad():
|
||||||
model.eval()
|
model.eval()
|
||||||
|
@ -6,7 +6,7 @@ GAME_TITLE = 'WMICraft'
|
|||||||
WINDOW_HEIGHT = 800
|
WINDOW_HEIGHT = 800
|
||||||
WINDOW_WIDTH = 1360
|
WINDOW_WIDTH = 1360
|
||||||
FPS_COUNT = 60
|
FPS_COUNT = 60
|
||||||
TURN_INTERVAL = 300
|
TURN_INTERVAL = 500
|
||||||
|
|
||||||
GRID_CELL_PADDING = 5
|
GRID_CELL_PADDING = 5
|
||||||
GRID_CELL_SIZE = 36
|
GRID_CELL_SIZE = 36
|
||||||
|
@ -61,8 +61,8 @@ class Game:
|
|||||||
if event.key == pygame.K_n:
|
if event.key == pygame.K_n:
|
||||||
print_numbers_flag = not print_numbers_flag
|
print_numbers_flag = not print_numbers_flag
|
||||||
|
|
||||||
if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds
|
# if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds
|
||||||
level.handle_turn()
|
# level.handle_turn()
|
||||||
|
|
||||||
stats.update()
|
stats.update()
|
||||||
logs.draw()
|
logs.draw()
|
||||||
|
@ -3,6 +3,7 @@ import random
|
|||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
from algorithms.a_star import a_star, State, TURN_RIGHT, TURN_LEFT, FORWARD
|
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 common.constants import *
|
||||||
from learning.decision_tree import DecisionTree
|
from learning.decision_tree import DecisionTree
|
||||||
from logic.knights_queue import KnightsQueue
|
from logic.knights_queue import KnightsQueue
|
||||||
@ -31,10 +32,12 @@ class Level:
|
|||||||
self.knights_queue = None
|
self.knights_queue = None
|
||||||
|
|
||||||
def create_map(self):
|
def create_map(self):
|
||||||
self.generate_map()
|
print("Create map")
|
||||||
self.setup_base_tiles()
|
print(what_is_it('../../resources/textures/grass1.png'))
|
||||||
self.setup_objects()
|
# self.generate_map()
|
||||||
self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red)
|
# self.setup_base_tiles()
|
||||||
|
# self.setup_objects()
|
||||||
|
# self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red)
|
||||||
|
|
||||||
def generate_map(self):
|
def generate_map(self):
|
||||||
spawner = Spawner(self.map)
|
spawner = Spawner(self.map)
|
||||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
Reference in New Issue
Block a user