Compare commits
3 Commits
master
...
3c5b05a7bb
Author | SHA1 | Date | |
---|---|---|---|
|
3c5b05a7bb | ||
|
50292376e7 | ||
|
ffe1ff9565 |
20
main.py
@ -4,8 +4,10 @@ import random
|
|||||||
import land
|
import land
|
||||||
import tractor
|
import tractor
|
||||||
import blocks
|
import blocks
|
||||||
|
import nn
|
||||||
import astar_search
|
import astar_search
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
@ -23,6 +25,8 @@ class Game:
|
|||||||
self.grass_body = []
|
self.grass_body = []
|
||||||
self.red_block = [] #aim block
|
self.red_block = [] #aim block
|
||||||
|
|
||||||
|
#self.one_body = []
|
||||||
|
|
||||||
self.fawn_seed_body = []
|
self.fawn_seed_body = []
|
||||||
self.fawn_wheat_body = []
|
self.fawn_wheat_body = []
|
||||||
|
|
||||||
@ -59,6 +63,15 @@ class Game:
|
|||||||
# self.potato = blocks.Blocks(self.surface, self.cell_size)
|
# self.potato = blocks.Blocks(self.surface, self.cell_size)
|
||||||
# self.potato.locate_soil('black earth', 6, 1, [])
|
# self.potato.locate_soil('black earth', 6, 1, [])
|
||||||
|
|
||||||
|
#class_names = ['Pumpkin', 'Tomato', 'Carrot']
|
||||||
|
|
||||||
|
self.neural_network = nn.NNModel("neural_network/save/second_model.pth")
|
||||||
|
|
||||||
|
# self.pumpkin_batch = self.neural_network.input_image("resources/pampkin.png")
|
||||||
|
# self.tomato_batch = self.neural_network.input_image("resources/tomato.png")
|
||||||
|
# self.carrot_batch = self.neural_network.input_image("resources/carrot.png")
|
||||||
|
|
||||||
|
|
||||||
self.tractor = tractor.Tractor(self.surface, self.cell_size)
|
self.tractor = tractor.Tractor(self.surface, self.cell_size)
|
||||||
self.tractor.draw()
|
self.tractor.draw()
|
||||||
|
|
||||||
@ -101,9 +114,16 @@ class Game:
|
|||||||
random_x = random.randrange(0, self.cell_number * self.cell_size, 50)
|
random_x = random.randrange(0, self.cell_number * self.cell_size, 50)
|
||||||
random_y = random.randrange(0, self.cell_number * self.cell_size, 50)
|
random_y = random.randrange(0, self.cell_number * self.cell_size, 50)
|
||||||
print("Generated target: ",random_x, random_y)
|
print("Generated target: ",random_x, random_y)
|
||||||
|
#aim-blue block
|
||||||
if self.red_block:
|
if self.red_block:
|
||||||
self.red_block.pop()
|
self.red_block.pop()
|
||||||
self.red_block.append([random_x/50, random_y/50])
|
self.red_block.append([random_x/50, random_y/50])
|
||||||
|
|
||||||
|
self.path_image = "resources/2.png"
|
||||||
|
self.aim_batch = self.neural_network.input_image(self.path_image)
|
||||||
|
self.predicate = self.neural_network.predicte(self.aim_batch)
|
||||||
|
|
||||||
|
|
||||||
# below line should be later moved into tractor.py
|
# below line should be later moved into tractor.py
|
||||||
angles = {0: 'UP', 90: 'RIGHT', 270: 'LEFT', 180: 'DOWN'}
|
angles = {0: 'UP', 90: 'RIGHT', 270: 'LEFT', 180: 'DOWN'}
|
||||||
#bandaid to know about stones
|
#bandaid to know about stones
|
||||||
|
BIN
neural_network/dataset/vegetables/test/Bean/0001.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0002.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0003.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0004.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0005.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0006.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0007.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0008.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0009.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0010.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0011.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0012.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0013.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0014.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0015.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0016.jpg
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0017.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0018.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0019.jpg
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0020.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0021.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0022.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0100.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0101.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0102.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0103.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0104.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0105.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0106.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0107.jpg
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0108.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0109.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0110.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0111.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0112.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0113.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0114.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0115.jpg
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0116.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0117.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0118.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0119.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0120.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0121.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0122.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0123.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0124.jpg
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0125.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0126.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0127.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0128.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0129.jpg
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0130.jpg
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0131.jpg
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0132.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0133.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0134.jpg
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0135.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0136.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0137.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0138.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0139.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0140.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0141.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0142.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0143.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0144.jpg
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0145.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0146.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0147.jpg
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0148.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0149.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0150.jpg
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0151.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0152.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0153.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0154.jpg
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0199.jpg
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0200.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0201.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0202.jpg
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0203.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0204.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0205.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0206.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0207.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0208.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0212.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0309.jpg
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0310.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0311.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0312.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0313.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0314.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0315.jpg
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0316.jpg
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0317.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0318.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
neural_network/dataset/vegetables/test/Bean/0319.jpg
Normal file
After Width: | Height: | Size: 14 KiB |