From 935ed5174b0a2f5cf4cf8b436de0d162ad1d9751 Mon Sep 17 00:00:00 2001 From: Neo Date: Thu, 19 Jun 2025 11:27:58 +0200 Subject: [PATCH] hopefully non-breaking changes to remove tensorflow requirement in systems that don't use it --- init_win.bat | 18 ++++++++++----- src/components/vision.py | 4 ++-- .../object_detection/utils/label_map_util.py | 4 ++-- src/requirements.txt | 3 +-- src/requirements_win.txt | 23 +++++++++++++++++++ 5 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 src/requirements_win.txt diff --git a/init_win.bat b/init_win.bat index c636374..ed555f8 100644 --- a/init_win.bat +++ b/init_win.bat @@ -2,16 +2,22 @@ :: RUN FROM POWERSHELL W/ADMIN RIGHTS: :: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -pip install -r src/requirements.txt +pip -m venv .venv + +pip install -r src/requirements_win.txt mkdir tmp cd tmp :: Advantech XNAVI -Invoke-WebRequest -uri "https://downloadt.advantech.com/download/downloadsr.aspx?File_Id=1-2BZC0F1" -usebasicparsing -outfile xnavi.zip -Expand-Archive .\xnavi.zip -cd xnavi -./xnavi.exe +:: BROKEN curl -o xnavi.zip "https://downloadt.advantech.com/download/downloadsr.aspx?File_Id=1-2BZC0F1" +:: Expand-Archive .\xnavi.zip +:: cd xnavi +:: ./xnavi.exe :: GXIPY -Invoke-WebRequest -uri "https://dahengimaging.com/downloads/Galaxy_Windows_EN_32bits%2064bits_1.18.2208.9301.zip" -usebasicparsing -OutFile Galaxy_Windows_EN_32bits_64bits_1.18.2208.9301.zip \ No newline at end of file +:: BROKEN curl -o gxipy.zip "https://dahengimaging.com/downloads/Galaxy_Windows_EN_32bits%2064bits_1.18.2208.9301.zip" + +:: GXIPY +curl -o vc_redist.x64.exe "https://aka.ms/vs/17/release/vc_redist.x64.exe" +./vc_redist.x64.exe \ No newline at end of file diff --git a/src/components/vision.py b/src/components/vision.py index c004f41..39fb96b 100644 --- a/src/components/vision.py +++ b/src/components/vision.py @@ -20,7 +20,7 @@ from .consumer import Consumer if "--no-gpu" in sys.argv: os.environ["CUDA_VISIBLE_DEVICES"] = "-1" -import tensorflow as tf +#import tensorflow as tf from lib.helpers.object_detection.utils import label_map_util if "--edgetpu" in sys.argv: @@ -35,7 +35,7 @@ else: def make_interpreter(*args, **kwargs): raise ValueError("\"--no-edgetpu\" in sys.argv") -if "--no-tflite" not in sys.argv: +if "--tflite" in sys.argv: try: Interpreter = tf.lite.Interpreter # from tflite_runtime.interpreter import Interpreter diff --git a/src/lib/helpers/object_detection/utils/label_map_util.py b/src/lib/helpers/object_detection/utils/label_map_util.py index 63af621..a495fdf 100644 --- a/src/lib/helpers/object_detection/utils/label_map_util.py +++ b/src/lib/helpers/object_detection/utils/label_map_util.py @@ -24,7 +24,7 @@ import logging import numpy as np from six import string_types from six.moves import range -import tensorflow.compat.v1 as tf +#import tensorflow.compat.v1 as tf from google.protobuf import text_format from lib.helpers.object_detection.protos import string_int_label_map_pb2 @@ -168,7 +168,7 @@ def load_labelmap(path): Returns: a StringIntLabelMapProto """ - with tf.io.gfile.GFile(path, 'r') as fid: + with open(path, 'r') as fid: label_map_string = fid.read() label_map = string_int_label_map_pb2.StringIntLabelMap() try: diff --git a/src/requirements.txt b/src/requirements.txt index 72f5f29..0068aef 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -20,5 +20,4 @@ requests #tensorflow #tflite-runtime zebra -pylibdmtx~=0.1.10 -pandas~=1.3.3 \ No newline at end of file +pylibdmtx~=0.1.10 \ No newline at end of file diff --git a/src/requirements_win.txt b/src/requirements_win.txt new file mode 100644 index 0000000..0b295c7 --- /dev/null +++ b/src/requirements_win.txt @@ -0,0 +1,23 @@ +--extra-index-url https://google-coral.github.io/py-repo/ +argon2-cffi +bottle +google-cloud-storage +imutils +lxml +nfcpy +numpy +opencv-python-headless +peewee +pillow +pycoral +pymodbus~=3.6.8 +pyqt5 +#pyqt5-tools +pyserial +pyserial-asyncio +qrcode +requests +tensorflow-cpu +#tflite-runtime +zebra +pylibdmtx~=0.1.10 \ No newline at end of file