no-log mode
This commit is contained in:
parent
dae6ffb6f5
commit
466d0ca575
6
agent.py
6
agent.py
@ -16,12 +16,12 @@ engine = Engine(SCREEN_SIZE, SQUARE_SIZE, kitchen, waiter, ACTION_DURATION)
|
|||||||
layout = LayoutController(engine, store).create_and_subscribe(COUNT_OF_OBJECTS)
|
layout = LayoutController(engine, store).create_and_subscribe(COUNT_OF_OBJECTS)
|
||||||
|
|
||||||
|
|
||||||
engine.loop()
|
# engine.loop()
|
||||||
|
|
||||||
'''
|
# '''
|
||||||
def example_stop(action_clock: int) -> bool:
|
def example_stop(action_clock: int) -> bool:
|
||||||
return action_clock < 1000
|
return action_clock < 1000
|
||||||
|
|
||||||
|
|
||||||
print(engine.train_loop(example_stop))
|
print(engine.train_loop(example_stop))
|
||||||
'''
|
# '''
|
||||||
|
@ -83,12 +83,14 @@ class Engine:
|
|||||||
real_action_duration = self.action_duration
|
real_action_duration = self.action_duration
|
||||||
self.action_duration = 0
|
self.action_duration = 0
|
||||||
self.is_simulation = True
|
self.is_simulation = True
|
||||||
|
self.predictor_c.is_simulation = True
|
||||||
|
|
||||||
while stop_condition(self.action_clock):
|
while stop_condition(self.action_clock):
|
||||||
self.action()
|
self.action()
|
||||||
|
|
||||||
self.action_duration = real_action_duration
|
self.action_duration = real_action_duration
|
||||||
self.is_simulation = False
|
self.is_simulation = False
|
||||||
|
self.predictor_c.is_simulation = False
|
||||||
|
|
||||||
return self.serviced_tables
|
return self.serviced_tables
|
||||||
|
|
||||||
@ -157,6 +159,7 @@ class Engine:
|
|||||||
self.goal = None
|
self.goal = None
|
||||||
|
|
||||||
def unattainable_goal(self):
|
def unattainable_goal(self):
|
||||||
|
if not self.is_simulation:
|
||||||
print(colored("Object unattainable", "red"))
|
print(colored("Object unattainable", "red"))
|
||||||
self.objects.remove(self.goal.parent)
|
self.objects.remove(self.goal.parent)
|
||||||
self.revoke_goal()
|
self.revoke_goal()
|
||||||
|
@ -28,6 +28,8 @@ class NeuralNetworkController:
|
|||||||
# STEP 5. Set up path to the folder containing test images
|
# STEP 5. Set up path to the folder containing test images
|
||||||
self.test_images_folder = 'dataset/testset'
|
self.test_images_folder = 'dataset/testset'
|
||||||
|
|
||||||
|
self.is_simulation = False
|
||||||
|
|
||||||
def predict(self, image_path):
|
def predict(self, image_path):
|
||||||
# STEP 1. Load and preprocess the test image
|
# STEP 1. Load and preprocess the test image
|
||||||
test_image = keras.preprocessing.image.load_img(
|
test_image = keras.preprocessing.image.load_img(
|
||||||
@ -44,6 +46,7 @@ class NeuralNetworkController:
|
|||||||
predicted_class_index = np.argmax(predictions[0])
|
predicted_class_index = np.argmax(predictions[0])
|
||||||
predicted_class = self.class_names[predicted_class_index]
|
predicted_class = self.class_names[predicted_class_index]
|
||||||
|
|
||||||
|
if not self.is_simulation:
|
||||||
print(colored("Predicted class: ", "yellow")+f"{predicted_class}")
|
print(colored("Predicted class: ", "yellow")+f"{predicted_class}")
|
||||||
return predicted_class
|
return predicted_class
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class StateController:
|
|||||||
self.path.append(self.path[-1].parent)
|
self.path.append(self.path[-1].parent)
|
||||||
total_cost += self.path[-1].cost
|
total_cost += self.path[-1].cost
|
||||||
|
|
||||||
|
if not engine.is_simulation:
|
||||||
print(colored(f"Total path cost: ", "green")+f"{total_cost}")
|
print(colored(f"Total path cost: ", "green")+f"{total_cost}")
|
||||||
return self.path
|
return self.path
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ class StateController:
|
|||||||
# STEP 1. Store goal position
|
# STEP 1. Store goal position
|
||||||
self.goal = engine.goal.position
|
self.goal = engine.goal.position
|
||||||
|
|
||||||
|
if not engine.is_simulation:
|
||||||
print(colored(f"Search path to ", "yellow")+f"{self.goal}")
|
print(colored(f"Search path to ", "yellow")+f"{self.goal}")
|
||||||
|
|
||||||
# STEP 2. Reset structures
|
# STEP 2. Reset structures
|
||||||
@ -73,6 +75,7 @@ class StateController:
|
|||||||
# STEP 9. Reset structures
|
# STEP 9. Reset structures
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
|
if not engine.is_simulation:
|
||||||
print(colored("Not found", "red"))
|
print(colored("Not found", "red"))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user