recognizer sie pierrdoli
This commit is contained in:
parent
5c0f2d5f15
commit
e0613a5477
21
assigning.py
21
assigning.py
@ -1,25 +1,18 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from codes_recognizer.rocognizer import recognizer
|
from codes_recognizer.rocognizer import recognizer
|
||||||
from board import get_shelfs
|
|
||||||
|
|
||||||
def assigning(product_code_path, board, shelfs):
|
|
||||||
|
|
||||||
|
def assigning(product_code_path, shelfs):
|
||||||
|
c = None
|
||||||
code = recognizer(product_code_path)
|
code = recognizer(product_code_path)
|
||||||
|
print(code)
|
||||||
|
product_color = str(code[0]) + str(code[1])
|
||||||
|
print(product_color)
|
||||||
for shelf in shelfs:
|
for shelf in shelfs:
|
||||||
if shelf.is_empty:
|
if shelf.color == product_color:
|
||||||
shelf.add_product(code)
|
shelf.add_product(code)
|
||||||
c = shelf.get_coordinates()
|
c = shelf.get_field()
|
||||||
break
|
|
||||||
else:
|
|
||||||
if shelf.get_product() == code:
|
|
||||||
shelf.add_product(code)
|
|
||||||
c = shelf.get_coordinates()
|
|
||||||
break
|
|
||||||
|
|
||||||
print("Product", product_code_path, "is on", c)
|
print("Product", product_code_path, "is on", c)
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ def recognizer(path):
|
|||||||
probab = list(ps.numpy()[0])
|
probab = list(ps.numpy()[0])
|
||||||
code.append(probab.index(max(probab)))
|
code.append(probab.index(max(probab)))
|
||||||
|
|
||||||
codes.append(code)
|
|
||||||
# cv2.imshow("Code", img)
|
# cv2.imshow("Code", img)
|
||||||
# cv2.waitKey()
|
# cv2.waitKey()
|
||||||
|
|
||||||
return codes
|
return code
|
||||||
|
|
||||||
|
2
data.py
2
data.py
@ -71,7 +71,7 @@ learning_data = [
|
|||||||
['red', 'rectangle', 235, 'big', 'dr-Gerard-PryncyPalki'],
|
['red', 'rectangle', 235, 'big', 'dr-Gerard-PryncyPalki'],
|
||||||
['white', 'rectangle', 25, 'medium', 'Nestle-Cini-Minis-Batonik'],
|
['white', 'rectangle', 25, 'medium', 'Nestle-Cini-Minis-Batonik'],
|
||||||
['black', 'pack', 70, 'big', 'Korsarz-Draze'],
|
['black', 'pack', 70, 'big', 'Korsarz-Draze'],
|
||||||
['white', 'rectangle', 50, 'medium', 'Góralki'],
|
['white', 'rectangle', 50, 'medium', 'Goralki'],
|
||||||
['white', 'rectangle', 24, 'medium', 'Kinder-Country'],
|
['white', 'rectangle', 24, 'medium', 'Kinder-Country'],
|
||||||
['red', 'rectangle', 46, 'medium', '3Bit'],
|
['red', 'rectangle', 46, 'medium', '3Bit'],
|
||||||
['yellow', 'rectangle', 25, 'medium', 'Nestle-Nesquik-Batonik'],
|
['yellow', 'rectangle', 25, 'medium', 'Nestle-Nesquik-Batonik'],
|
||||||
|
2
main.py
2
main.py
@ -78,7 +78,7 @@ def run():
|
|||||||
Wyznacza patha do polki na ktora ma polozyc produkt.
|
Wyznacza patha do polki na ktora ma polozyc produkt.
|
||||||
'''
|
'''
|
||||||
# list [x, y]
|
# list [x, y]
|
||||||
dest_shelf = new_product.shelf(board)
|
dest_shelf = new_product.shelf(shelfs)
|
||||||
path = functions.a_star(board[agent.y][agent.x], dest_shelf.get_field(), board)
|
path = functions.a_star(board[agent.y][agent.x], dest_shelf.get_field(), board)
|
||||||
|
|
||||||
''''''
|
''''''
|
||||||
|
@ -31,6 +31,6 @@ class FinalProduct:
|
|||||||
|
|
||||||
self.img = create_image(self)
|
self.img = create_image(self)
|
||||||
|
|
||||||
def shelf(self, board):
|
def shelf(self, shelfs):
|
||||||
print(self.img)
|
print(self.img)
|
||||||
return assigning(self.img, board);
|
return assigning(self.img, shelfs);
|
||||||
|
Loading…
Reference in New Issue
Block a user