forked from s444420/AL-2020
agent can put one product.py
This commit is contained in:
parent
d9c2092551
commit
e1eab58672
@ -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)
|
||||
|
5
main.py
5
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:
|
||||
|
@ -32,4 +32,5 @@ class FinalProduct:
|
||||
self.img = create_image(self)
|
||||
|
||||
def shelf(self):
|
||||
print(self.img)
|
||||
return assigning(self.img);
|
||||
|
Loading…
Reference in New Issue
Block a user