refactor #26
@ -194,11 +194,15 @@ class Tractor:
|
|||||||
|
|
||||||
def snake_move_predict_plant(self, pole, model):
|
def snake_move_predict_plant(self, pole, model):
|
||||||
initPos = (self.slot.x_axis, self.slot.y_axis)
|
initPos = (self.slot.x_axis, self.slot.y_axis)
|
||||||
|
count = 0
|
||||||
for i in range(initPos[1], dCon.NUM_Y):
|
for i in range(initPos[1], dCon.NUM_Y):
|
||||||
for j in range(initPos[0], dCon.NUM_X):
|
for j in range(initPos[0], dCon.NUM_X):
|
||||||
if self.slot.imagePath != None:
|
if self.slot.imagePath != None:
|
||||||
predictedLabel = nn.predictLabel(self.slot.imagePath, model)
|
predictedLabel = nn.predictLabel(self.slot.imagePath, model)
|
||||||
print(str("Coords: ({:02d}, {:02d})").format(self.slot.x_axis, self.slot.y_axis), "real:", self.slot.label, "predicted:", predictedLabel, "correct" if (self.slot.label == predictedLabel) else "incorrect", 'nawożę za pomocą:', nn.fertilizer[predictedLabel])
|
print(str("Coords: ({:02d}, {:02d})").format(self.slot.x_axis, self.slot.y_axis), "real:", self.slot.label, "predicted:", predictedLabel, "correct" if (self.slot.label == predictedLabel) else "incorrect", 'nawożę za pomocą:', nn.fertilizer[predictedLabel])
|
||||||
|
if self.slot.label != predictedLabel:
|
||||||
|
self.slot.mark_visited()
|
||||||
|
count += 1
|
||||||
self.move_forward(pole, False)
|
self.move_forward(pole, False)
|
||||||
if i % 2 == 0 and i != dCon.NUM_Y - 1:
|
if i % 2 == 0 and i != dCon.NUM_Y - 1:
|
||||||
self.turn_right()
|
self.turn_right()
|
||||||
@ -208,6 +212,7 @@ class Tractor:
|
|||||||
self.turn_left()
|
self.turn_left()
|
||||||
self.move_forward(pole, False)
|
self.move_forward(pole, False)
|
||||||
self.turn_left()
|
self.turn_left()
|
||||||
|
print(f"źle nawiezionych roślin: {count}")
|
||||||
|
|
||||||
def snake_move(self,pole,x,y):
|
def snake_move(self,pole,x,y):
|
||||||
next_slot_coordinates=(x,y)
|
next_slot_coordinates=(x,y)
|
||||||
|
Loading…
Reference in New Issue
Block a user