Merge remote-tracking branch 'origin/master'
# Conflicts: # src/components/vision.py
This commit is contained in:
commit
9b6645fdf9
@ -32,6 +32,7 @@ $* 2> >(sed $'s/.*/\e[31m&\e[m/' >&2) # &
|
|||||||
# --no-gui \
|
# --no-gui \
|
||||||
# --no-tflite \
|
# --no-tflite \
|
||||||
# --sim-archiver \
|
# --sim-archiver \
|
||||||
|
# --sim-vision \
|
||||||
# --users-management \
|
# --users-management \
|
||||||
# sudo renice -n -10 $!
|
# sudo renice -n -10 $!
|
||||||
# fg
|
# fg
|
||||||
|
|||||||
@ -165,7 +165,7 @@ class TecnaMarpossProvasetT3P(ModbusComponent):
|
|||||||
"Test program for read/write operation": table,
|
"Test program for read/write operation": table,
|
||||||
**{719 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)},
|
**{719 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)},
|
||||||
"Test type": "Leak Test",
|
"Test type": "Leak Test",
|
||||||
"Test flags": 0b0110000001011000,
|
"Test flags": 0b0110000001011100,
|
||||||
"T0 - Pre-filling time": recipe.spec["pre_filling_time"],
|
"T0 - Pre-filling time": recipe.spec["pre_filling_time"],
|
||||||
"P0 - Pre-filling pressure": recipe.spec["pre_filling_pressure"],
|
"P0 - Pre-filling pressure": recipe.spec["pre_filling_pressure"],
|
||||||
"T1 - Filling time": recipe.spec["filling_time"],
|
"T1 - Filling time": recipe.spec["filling_time"],
|
||||||
|
|||||||
@ -22,7 +22,6 @@ from PyQt5.QtGui import (QBrush, QColor, QFont, QImage, QPainter, QPainterPath,
|
|||||||
from .component import Component
|
from .component import Component
|
||||||
from .consumer import Consumer
|
from .consumer import Consumer
|
||||||
|
|
||||||
|
|
||||||
if "--no-edgetpu" not in sys.argv:
|
if "--no-edgetpu" not in sys.argv:
|
||||||
try:
|
try:
|
||||||
from pycoral.utils.edgetpu import make_interpreter
|
from pycoral.utils.edgetpu import make_interpreter
|
||||||
@ -48,7 +47,6 @@ else:
|
|||||||
def Interpreter(*args, **kwargs):
|
def Interpreter(*args, **kwargs):
|
||||||
raise ValueError("\"--no-tflite\" in sys.argv")
|
raise ValueError("\"--no-tflite\" in sys.argv")
|
||||||
|
|
||||||
|
|
||||||
# # Patch the location of gfile
|
# # Patch the location of gfile
|
||||||
# tf.gfile = tf.io.gfile
|
# tf.gfile = tf.io.gfile
|
||||||
|
|
||||||
@ -293,6 +291,9 @@ class Vision(Component):
|
|||||||
tf_mode = None
|
tf_mode = None
|
||||||
# reset tflite variables
|
# reset tflite variables
|
||||||
interpreter = None
|
interpreter = None
|
||||||
|
if self.simulate:
|
||||||
|
tf_mode = "simulation"
|
||||||
|
interpreter = None
|
||||||
if tf_mode is None and "edgetpu" in self.allowed_modes:
|
if tf_mode is None and "edgetpu" in self.allowed_modes:
|
||||||
try:
|
try:
|
||||||
# create tflite edgetpu interpreter
|
# create tflite edgetpu interpreter
|
||||||
@ -334,14 +335,6 @@ class Vision(Component):
|
|||||||
self.loading_model_signal.emit({"status": "done"})
|
self.loading_model_signal.emit({"status": "done"})
|
||||||
|
|
||||||
def check_features(self, frame, lock=True):
|
def check_features(self, frame, lock=True):
|
||||||
# test_box = [i * s for i, s in zip([0.2, 0.2, 0.8, 0.8], frame.shape[:2] * 2)]
|
|
||||||
# return [{
|
|
||||||
# "class": self.category_index[1],
|
|
||||||
# "score": 1.0,
|
|
||||||
# "box": test_box, # rescale detection to frame size,
|
|
||||||
# "center": self.get_center(test_box),
|
|
||||||
# "size": self.get_size(test_box),
|
|
||||||
# }]
|
|
||||||
if self.interpreter is not None and frame.shape != self.interpreter.get_input_details()[0]["shape"][1:3]:
|
if self.interpreter is not None and frame.shape != self.interpreter.get_input_details()[0]["shape"][1:3]:
|
||||||
tensor = np.expand_dims(cv2.resize(frame, self.interpreter.get_input_details()[0]["shape"][1:3], interpolation=cv2.INTER_LINEAR), axis=0)
|
tensor = np.expand_dims(cv2.resize(frame, self.interpreter.get_input_details()[0]["shape"][1:3], interpolation=cv2.INTER_LINEAR), axis=0)
|
||||||
else:
|
else:
|
||||||
@ -349,7 +342,15 @@ class Vision(Component):
|
|||||||
# Run inference
|
# Run inference
|
||||||
if lock:
|
if lock:
|
||||||
self.lock.lock()
|
self.lock.lock()
|
||||||
if self.tf_mode in {"edgetpu", "tflite"}:
|
if self.simulate or tf_mode == "simulation":
|
||||||
|
detections = {
|
||||||
|
"detection_scores": [[1.0]],
|
||||||
|
"detection_boxes": [[[0.2, 0.2, 0.8, 0.8]]],
|
||||||
|
"detection_classes": [[1]],
|
||||||
|
}
|
||||||
|
if lock:
|
||||||
|
self.lock.unlock()
|
||||||
|
elif self.tf_mode in {"edgetpu", "tflite"}:
|
||||||
i_d = self.interpreter.get_input_details()
|
i_d = self.interpreter.get_input_details()
|
||||||
# print(i_d)
|
# print(i_d)
|
||||||
o_d = self.interpreter.get_output_details()
|
o_d = self.interpreter.get_output_details()
|
||||||
@ -526,7 +527,7 @@ class Vision(Component):
|
|||||||
"detection": detection,
|
"detection": detection,
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
"ok": False, # all(map(lambda detection: detection["ok"] is True, checked.values())),
|
"ok": all(map(lambda detection: detection["ok"] is True, checked.values())),
|
||||||
"results": checked,
|
"results": checked,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,14 +71,13 @@ Recipes.replace(id=0, name="TEST", spec={
|
|||||||
# filling
|
# filling
|
||||||
"filling_time": 5,
|
"filling_time": 5,
|
||||||
"settling_time": 10,
|
"settling_time": 10,
|
||||||
"settling_pressure_min_percent": 20,
|
"settling_pressure_min_percent": 10,
|
||||||
"settling_pressure_max_percent": 20,
|
"settling_pressure_max_percent": 10,
|
||||||
# test
|
# test
|
||||||
"test_time": 20,
|
"test_time": 10,
|
||||||
"test_pressure_min_delta": 3.00,
|
"test_pressure_min_delta": 3.00,
|
||||||
"test_pressure": 3000,
|
"test_pressure": 3000,
|
||||||
"test_pressure_max_delta": 0.25,
|
"test_pressure_max_delta": 0.25,
|
||||||
"cycles": 1,
|
|
||||||
# flush
|
# flush
|
||||||
"flush_time": 2,
|
"flush_time": 2,
|
||||||
"flush_pressure": 5,
|
"flush_pressure": 5,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user