fix nogpu

This commit is contained in:
matteo porta 2022-07-18 15:52:23 +02:00
parent f8df4a4105
commit a8e025f7a8

View File

@ -7,8 +7,6 @@ from pathlib import Path
import cv2 import cv2
import numpy as np import numpy as np
import tensorflow as tf
from lib.helpers.object_detection.utils import label_map_util
from PyQt5.QtCore import (QFileSystemWatcher, QLineF, QMutex, QPointF, QRectF, from PyQt5.QtCore import (QFileSystemWatcher, QLineF, QMutex, QPointF, QRectF,
Qt, QThread, pyqtSignal) Qt, QThread, pyqtSignal)
from PyQt5.QtGui import (QBrush, QColor, QFont, QImage, QPainter, QPainterPath, from PyQt5.QtGui import (QBrush, QColor, QFont, QImage, QPainter, QPainterPath,
@ -17,6 +15,12 @@ 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-gpu" in sys.argv:
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
from lib.helpers.object_detection.utils import label_map_util
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
@ -42,9 +46,6 @@ else:
def Interpreter(*args, **kwargs): def Interpreter(*args, **kwargs):
raise ValueError("\"--no-tflite\" in sys.argv") raise ValueError("\"--no-tflite\" in sys.argv")
if "--no-gpu" in sys.argv:
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
# # Patch the location of gfile # # Patch the location of gfile
# tf.gfile = tf.io.gfile # tf.gfile = tf.io.gfile