From e1eab58672279685b505a4f20bab680a64744a45 Mon Sep 17 00:00:00 2001 From: shaaqu Date: Tue, 9 Jun 2020 19:09:46 +0200 Subject: [PATCH] agent can put one product.py --- codes_recognizer/{nn_model.py => network_model.py} | 0 codes_recognizer/rocognizer.py | 5 ++--- main.py | 5 ++++- product.py | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) rename codes_recognizer/{nn_model.py => network_model.py} (100%) diff --git a/codes_recognizer/nn_model.py b/codes_recognizer/network_model.py similarity index 100% rename from codes_recognizer/nn_model.py rename to codes_recognizer/network_model.py diff --git a/codes_recognizer/rocognizer.py b/codes_recognizer/rocognizer.py index 56a17a4..8e4d4c8 100644 --- a/codes_recognizer/rocognizer.py +++ b/codes_recognizer/rocognizer.py @@ -1,7 +1,7 @@ import cv2 import torch -from nn_model import Net from torchvision.transforms import transforms +from codes_recognizer.network_model import Net def recognizer(path): @@ -14,9 +14,8 @@ def recognizer(path): # load nn model model = Net() - model.load_state_dict(torch.load('model.pt')) + model.load_state_dict(torch.load('codes_recognizer/model.pt')) model.eval() - img = cv2.imread(path) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) diff --git a/main.py b/main.py index e7ddcd1..5c6dfcd 100644 --- a/main.py +++ b/main.py @@ -76,11 +76,14 @@ def run(): ''' # list [x, y] dest_shelf = new_product.shelf() - dest_field = board[dest_shelf[0], dest_shelf[1]] + dest_field = board[dest_shelf[0]][dest_shelf[1]] path = functions.a_star(board[agent.y][agent.x], dest_field, board) '''''' agent.item = new_product + path.pop(len(path) - 1) + next_step = path.pop(len(path) - 1) + agent.is_busy = True if next_step is not None: diff --git a/product.py b/product.py index e16ea9c..8c62f06 100644 --- a/product.py +++ b/product.py @@ -32,4 +32,5 @@ class FinalProduct: self.img = create_image(self) def shelf(self): + print(self.img) return assigning(self.img);