Dodany plik do projektu wspólnego, zmodyfikowany podprojekt na potrzeby projektu wspólnego

This commit is contained in:
Marcin Kwapisz 2020-06-03 14:08:43 +02:00
parent ee0c10e457
commit 33bd4b6ec3
6 changed files with 228 additions and 7 deletions

View File

@ -74,3 +74,14 @@ class main():
return 3 return 3
elif self.mode_value in [6]: elif self.mode_value in [6]:
return 10 return 10
def main_collective(self,poz):
self.pole = self.ui.field_images[self.field.get_value(poz)]
self.img = pygame.surfarray.array3d(self.pole)
self.img = self.img.transpose([1, 0, 2])
self.img = cv2.cvtColor(self.img, cv2.COLOR_RGB2BGR)
self.reco = self.mode(self.recognition(self.img))
if self.reco == 10:
print("Nic nie trzeba robić")
else:
self.traktor.set_mode(self.reco)

15
collective.py Normal file
View File

@ -0,0 +1,15 @@
class main():
def __init__(self,marcin, justyna, kamila, piotrek, traktor, pole, UI, path):
self.marcin = marcin
self.justyna = justyna
self.kamila = kamila
self.piotrek = piotrek
self.traktor = traktor
self.pole = pole
self.UI = UI
self.path = path
def main(self):
# self.marcin.main_collective(pozycja) To podaje jakie jest pole jest na danym miejscu
pass

18
main.py
View File

@ -1,5 +1,5 @@
import pygame, sys import pygame, sys
import tractor, pathfinding, field, ui, Justyna, Kamila, Marcin, Piotrek, pathfinding_decision import tractor, pathfinding, field, ui, Justyna, Kamila, Marcin, Piotrek, pathfinding_decision, collective
from pygame.locals import * from pygame.locals import *
pole = field.field() pole = field.field()
@ -10,6 +10,7 @@ j = Justyna.main(traktor,pole,UI,path)
k = Kamila.main(traktor,pole,UI,pathfinding_decision.pathfinding_dec()) k = Kamila.main(traktor,pole,UI,pathfinding_decision.pathfinding_dec())
neuro = Marcin.main(traktor,pole,UI,path) neuro = Marcin.main(traktor,pole,UI,path)
p = Piotrek.main(traktor,pole,UI,path) p = Piotrek.main(traktor,pole,UI,path)
c = collective.main(neuro,j,k,p,traktor,pole,UI,path)
pygame.init() pygame.init()
UI.update() UI.update()
UI.update() UI.update()
@ -41,12 +42,6 @@ while True:
traktor.set_mode(3) traktor.set_mode(3)
if key[K_p]: if key[K_p]:
path.pathfinding(traktor,pole,UI) path.pathfinding(traktor,pole,UI)
if key[K_F9]:
print(pole.if_value(traktor.get_modes_values()))
if key[K_F10]:
print(traktor.get_poz())
if key[K_F11]:
print(traktor.get_field_value())
if key[K_F5]: if key[K_F5]:
#Dla projektu Justyny #Dla projektu Justyny
j.main() j.main()
@ -59,6 +54,15 @@ while True:
if key[K_F8]: if key[K_F8]:
# Dla projektu Piotrka # Dla projektu Piotrka
p.main() p.main()
if key[K_F9]:
print(pole.if_value(traktor.get_modes_values()))
if key[K_F10]:
print(traktor.get_poz())
if key[K_F11]:
print(traktor.get_field_value())
if key[K_12]:
c.main()
UI.update() UI.update()
UI.update() UI.update()

182
si.cfg Normal file
View File

@ -0,0 +1,182 @@
[net]
# Testing
batch=24
subdivisions=8
# Training
# batch=64
# subdivisions=2
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1
learning_rate=0.001
burn_in=1000
max_batches = 500200
policy=steps
steps=400000,450000
scales=.1,.1
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=1
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
###########
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=42
activation=linear
[yolo]
mask = 3,4,5
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=9
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
[route]
layers = -4
[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky
[upsample]
stride=2
[route]
layers = -1, 8
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=42
activation=linear
[yolo]
mask = 0,1,2
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=9
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1

9
si.names Normal file
View File

@ -0,0 +1,9 @@
0
1
2
3
4
5
6
7
8

BIN
si_20000.weights Normal file

Binary file not shown.