diff --git a/Marcin.py b/Marcin.py index eac09c7..4a5f415 100644 --- a/Marcin.py +++ b/Marcin.py @@ -74,3 +74,14 @@ class main(): return 3 elif self.mode_value in [6]: 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) \ No newline at end of file diff --git a/collective.py b/collective.py new file mode 100644 index 0000000..a797c37 --- /dev/null +++ b/collective.py @@ -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 \ No newline at end of file diff --git a/main.py b/main.py index 610c939..a0bda4d 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ 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 * pole = field.field() @@ -10,6 +10,7 @@ j = Justyna.main(traktor,pole,UI,path) k = Kamila.main(traktor,pole,UI,pathfinding_decision.pathfinding_dec()) neuro = Marcin.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() UI.update() UI.update() @@ -41,12 +42,6 @@ while True: traktor.set_mode(3) if key[K_p]: 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]: #Dla projektu Justyny j.main() @@ -59,6 +54,15 @@ while True: if key[K_F8]: # Dla projektu Piotrka 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() diff --git a/si.cfg b/si.cfg new file mode 100644 index 0000000..36a42d4 --- /dev/null +++ b/si.cfg @@ -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 diff --git a/si.names b/si.names new file mode 100644 index 0000000..1000f90 --- /dev/null +++ b/si.names @@ -0,0 +1,9 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 diff --git a/si_20000.weights b/si_20000.weights new file mode 100644 index 0000000..508285a Binary files /dev/null and b/si_20000.weights differ