localdev
This commit is contained in:
parent
f8df4a4105
commit
b3568e3417
|
|
@ -9,9 +9,9 @@ exposure_time: 10000
|
|||
; vertical_crop_resolution: 2048
|
||||
; rotate_90_clockwise times: 0
|
||||
; auto_white_balance: off
|
||||
; balance_red: 1.0
|
||||
; balance_green: 1.0
|
||||
; balance_blue: 1.0
|
||||
balance_red: 1.66
|
||||
balance_green: 1.0
|
||||
balance_blue: 1.12
|
||||
|
||||
[vision_saver]
|
||||
time_format: %Y-%m-%d_%H-%M-%S
|
||||
|
|
@ -44,4 +44,6 @@ baudrate: 9600
|
|||
|
||||
[vision]
|
||||
detection_threshold: 0.3
|
||||
neural_network: hs2-50000
|
||||
|
||||
; recipes_path: ./config/vision_test_recipes
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
item {
|
||||
id: 1
|
||||
name: 'hs-ok'
|
||||
color: '0x00ff00'
|
||||
color: '0x555555'
|
||||
}
|
||||
item {
|
||||
id: 2
|
||||
|
|
@ -11,5 +11,5 @@ item {
|
|||
item {
|
||||
id: 3
|
||||
name: 'hs-empty'
|
||||
color: '0x0000ff'
|
||||
color: '0xaaaaaa'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# LIEBHER RUBBER FLANGE
|
||||
|
||||
[general]
|
||||
name: RICETTA 1
|
||||
instruction: APPORRE I SEGNI CON IL PENNARELLO COME INDICATO IN FIGURA
|
||||
name: TERMORESTRINGENTE
|
||||
instruction: CONTROLLARE PRESENZA TERMORESTRINGENTE
|
||||
|
||||
# POINTS FORMAT:
|
||||
# point_name: point_center point_size fill_color border_color border_thickness shape
|
||||
|
|
@ -20,15 +20,9 @@ instruction: APPORRE I SEGNI CON IL PENNARELLO COME INDICATO IN FIGURA
|
|||
# name: X,Y S 0xAARRGGBB 0xAARRGGBB T TEXT
|
||||
|
||||
[markers]
|
||||
cross: 1100,1100 100,100 0x000000ff 0xff0000ff 25 cross
|
||||
center: 1100,1100 2050,2050 0x0000ff00 0xff0000ff 50 ellipse
|
||||
|
||||
[zones]
|
||||
p1: 610,550 200 hs-ok # TOP LEFT WHITE POINT
|
||||
p2: 1790,1290 200 hs-ok # RIGHT SIDE WHITE POINT
|
||||
p3: 350,1190 200 hs-ok # LEFT SIDE BLUE POINT
|
||||
p1: 800,700 100,200 hs-ok # HEATSINK PRESENT
|
||||
|
||||
[labels]
|
||||
p1: 510,825 100 0xffffffff 0xff000000 10 BIANCO
|
||||
p2: 1690,1565 100 0xffffffff 0xff000000 10 BIANCO
|
||||
p3: 250,1465 100 0xff0000ff 0xff000000 10 BLU
|
||||
p1: 600,500 100 0xffffffff 0xffffffff 10 TERMORESTRINGENTE
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
# LIEBHER RUBBER FLANGE
|
||||
|
||||
[general]
|
||||
name: RICETTA 2
|
||||
instruction: APPORRE I SEGNI CON IL PENNARELLO COME INDICATO IN FIGURA
|
||||
|
||||
# POINTS FORMAT:
|
||||
# point_name: point_center point_size fill_color border_color border_thickness shape
|
||||
# EXAMPLE:
|
||||
# name: X,Y W,H 0xAARRGGBB 0xAARRGGBB T SHAPE CLASS
|
||||
# ZONES FORMAT:
|
||||
# region_name: region_center region_margin class
|
||||
# margin can be a box (XM*2,YM*2) or a radius (R)
|
||||
# EXAMPLES:
|
||||
# name: X,Y XM,YM T SHAPE CLASS
|
||||
# name: X,Y R T SHAPE CLASS
|
||||
# LABELS FORMAT:
|
||||
# label_name: label_start_location font_size fill_color border_color border_thickness text
|
||||
# EXAMPLE:
|
||||
# name: X,Y S 0xAARRGGBB 0xAARRGGBB T TEXT
|
||||
|
||||
[markers]
|
||||
cross: 1100,1100 100,100 0x000000ff 0xff0000ff 25 cross
|
||||
center: 1100,1100 2050,2050 0x0000ff00 0xff0000ff 50 ellipse
|
||||
|
||||
[zones]
|
||||
p1: 610,550 200 hs-ok # TOP LEFT WHITE POINT
|
||||
p2: 1790,1290 200 hs-ok # RIGHT SIDE WHITE POINT
|
||||
p3: 350,1190 200 hs-ok # LEFT SIDE BLUE POINT
|
||||
|
||||
[labels]
|
||||
p1: 510,825 100 0xffffffff 0xff000000 10 BIANCO
|
||||
p2: 1690,1565 100 0xffffffff 0xff000000 10 BIANCO
|
||||
p3: 250,1465 100 0xff0000ff 0xff000000 10 BLU
|
||||
|
|
@ -14,12 +14,10 @@ export QT_NO_WARNING_OUTPUT=0
|
|||
# export QT_QPA_PLATFORM=${XDG_SESSION_TYPE}
|
||||
python -B -u "./src/main.py" \
|
||||
--auto-login-admin \
|
||||
--auto-select \
|
||||
--no-autotest \
|
||||
--no-edgetpu \
|
||||
--no-gpu \
|
||||
--panel \
|
||||
--sim-camera \
|
||||
--sim-modbus \
|
||||
--sim-os-label-printer \
|
||||
--sim-serial \
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class Component(QObject):
|
|||
self._lock.release()
|
||||
return running
|
||||
|
||||
def wait_ready(self, timeout=5):
|
||||
def wait_ready(self, timeout=10):
|
||||
"""
|
||||
waits untill the requested action has been completed by the component
|
||||
this will return immediately if threaded=False was passed at component initialization
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ from pathlib import Path
|
|||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
if "--no-gpu" in sys.argv:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
||||
|
||||
import tensorflow as tf
|
||||
from lib.helpers.object_detection.utils import label_map_util
|
||||
from PyQt5.QtCore import (QFileSystemWatcher, QLineF, QMutex, QPointF, QRectF,
|
||||
|
|
@ -17,6 +22,7 @@ from PyQt5.QtGui import (QBrush, QColor, QFont, QImage, QPainter, QPainterPath,
|
|||
from .component import Component
|
||||
from .consumer import Consumer
|
||||
|
||||
|
||||
if "--no-edgetpu" not in sys.argv:
|
||||
try:
|
||||
from pycoral.utils.edgetpu import make_interpreter
|
||||
|
|
@ -42,8 +48,6 @@ else:
|
|||
def Interpreter(*args, **kwargs):
|
||||
raise ValueError("\"--no-tflite\" in sys.argv")
|
||||
|
||||
if "--no-gpu" in sys.argv:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
||||
|
||||
# # Patch the location of gfile
|
||||
# tf.gfile = tf.io.gfile
|
||||
|
|
@ -69,6 +73,9 @@ class Vision(Component):
|
|||
self.vision_consumer.moveToThread(self.vision_consumer_thread)
|
||||
self.vision_consumer_thread.started.connect(self.vision_consumer.start)
|
||||
self.vision_consumer_thread.start()
|
||||
QApplication.processEvents()
|
||||
QThread.msleep(1000)
|
||||
QApplication.processEvents()
|
||||
self.vision_consumer.wait_ready()
|
||||
# RENDER THREAD
|
||||
self.render_consumer = Consumer(work=self.render_consumer_work, work_fifo=True, drop_fifo=True, work_maxlen=1, name="render_consumer", paused=False)
|
||||
|
|
@ -77,6 +84,9 @@ class Vision(Component):
|
|||
self.render_consumer.moveToThread(self.render_consumer_thread)
|
||||
self.render_consumer_thread.started.connect(self.render_consumer.start)
|
||||
self.render_consumer_thread.start()
|
||||
QApplication.processEvents()
|
||||
QThread.msleep(1000)
|
||||
QApplication.processEvents()
|
||||
self.render_consumer.wait_ready()
|
||||
# CONNECT CONSUMERS
|
||||
self.vision_consumer.out.connect(self.process_vision_consumed)
|
||||
|
|
@ -275,6 +285,8 @@ class Vision(Component):
|
|||
"none",
|
||||
]:
|
||||
model_name = sorted([d for d in os.listdir(self.models_dir) if os.path.isdir(self.models_dir / d)], reverse=True)[0]
|
||||
else:
|
||||
model_name = model
|
||||
self.log.info(f"loading neural network: {model_name!r}")
|
||||
self.loading_model_signal.emit({"status": "loading"})
|
||||
self.lock.lock()
|
||||
|
|
@ -429,8 +441,10 @@ class Vision(Component):
|
|||
# filtering out those that do not contain the detection
|
||||
min_distance = sys.maxsize
|
||||
closest_zone = None
|
||||
outside_zone = True
|
||||
for zone_name, zone in self.zones.items():
|
||||
if zone["shape"] == "rect":
|
||||
distance = self.get_distance(detection["center"], zone["center"])
|
||||
if self.zone_detection_filter_mode == "center_inside":
|
||||
outside_zone = any([
|
||||
detection["center"][0] < zone["box"][0],
|
||||
|
|
@ -512,7 +526,7 @@ class Vision(Component):
|
|||
"detection": detection,
|
||||
}
|
||||
return {
|
||||
"ok": all(map(lambda detection: detection["ok"] is True, checked.values())),
|
||||
"ok": False, # all(map(lambda detection: detection["ok"] is True, checked.values())),
|
||||
"results": checked,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ try:
|
|||
component = self.components[component_name]
|
||||
thread.started.connect(component.start)
|
||||
thread.start()
|
||||
QApplication.processEvents()
|
||||
QThread.msleep(1000)
|
||||
QApplication.processEvents()
|
||||
if component_name == "vision":
|
||||
component.wait_ready(timeout=60)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user