Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Refactor Qt Wrappers #5523

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions XSegEditor/QCursorDB.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

class QCursorDB():
@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions XSegEditor/QIconDB.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *


class QIconDB():
Expand Down
6 changes: 3 additions & 3 deletions XSegEditor/QImageDB.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

class QImageDB():
@staticmethod
Expand Down
13 changes: 6 additions & 7 deletions XSegEditor/XSegEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import cv2
import numpy as np
import numpy.linalg as npla
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

from core import imagelib, pathex
from core.cv2ex import *
Expand Down Expand Up @@ -152,9 +152,9 @@ def __init__(self,

if color_schemes is None:
color_schemes = [
ColorScheme( QColor(192,0,0,alpha=0), QColor(192,0,0,alpha=72), QColor(192,0,0), 2, QColor(255,255,255), QCursorDB.cross_red ),
ColorScheme( QColor(0,192,0,alpha=0), QColor(0,192,0,alpha=72), QColor(0,192,0), 2, QColor(255,255,255), QCursorDB.cross_green ),
ColorScheme( QColor(0,0,192,alpha=0), QColor(0,0,192,alpha=72), QColor(0,0,192), 2, QColor(255,255,255), QCursorDB.cross_blue ),
ColorScheme( QColor(192,0,0), QColor(192,0,0), QColor(192,0,0), 2, QColor(255,255,255), QCursorDB.cross_red ),
ColorScheme( QColor(0,192,0), QColor(0,192,0), QColor(0,192,0), 2, QColor(255,255,255), QCursorDB.cross_green ),
ColorScheme( QColor(0,0,192), QColor(0,0,192), QColor(0,0,192), 2, QColor(255,255,255), QCursorDB.cross_blue ),
]
self.color_schemes = color_schemes

Expand Down Expand Up @@ -941,7 +941,6 @@ def paintEvent(self, event):
qp = self.qp
qp.begin(self)
qp.setRenderHint(QPainter.Antialiasing)
qp.setRenderHint(QPainter.HighQualityAntialiasing)
qp.setRenderHint(QPainter.SmoothPixmapTransform)

src_rect = QRect(0, 0, *self.img_size)
Expand Down
4 changes: 2 additions & 2 deletions core/imagelib/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def gen_warp_params (w, flip=False, rotation_range=[-10,10], scale_range=[-0.5,
################

#random transform
random_transform_mat = cv2.getRotationMatrix2D((w // 2, w // 2), rotation, scale)
random_transform_mat = cv2.getRotationMatrix2D((int(w // 2), int(w // 2)), rotation, scale)
random_transform_mat[:, 2] += (tx*w, ty*w)

params = dict()
Expand Down Expand Up @@ -178,4 +178,4 @@ def warp_by_params (params, img, can_warp, can_transform, can_flip, border_repli
img = img[...,None]
if can_flip and params['flip']:
img = img[:,::-1,...]
return img
return img
6 changes: 3 additions & 3 deletions core/leras/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_best_device(self):
idx_mem = 0
for device in self.devices:
mem = device.total_mem
if mem > idx_mem:
if mem >= idx_mem:
result = device
idx_mem = mem
return result
Expand All @@ -56,7 +56,7 @@ def get_worst_device(self):
idx_mem = sys.maxsize
for device in self.devices:
mem = device.total_mem
if mem < idx_mem:
if mem <= idx_mem:
result = device
idx_mem = mem
return result
Expand Down Expand Up @@ -270,4 +270,4 @@ def getDevices():
os.environ[f'NN_DEVICE_{i}_TOTAL_MEM'] = str(device['total_mem'])
os.environ[f'NN_DEVICE_{i}_FREE_MEM'] = str(device['free_mem'])
os.environ[f'NN_DEVICE_{i}_CC'] = str(device['cc'])
"""
"""
1 change: 1 addition & 0 deletions core/leras/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def initialize(device_config=None, floatx="float32", data_format="NHWC"):

config.gpu_options.force_gpu_compatible = True
config.gpu_options.allow_growth = True
config.allow_soft_placement = True
nn.tf_sess_config = config

if nn.tf_sess is None:
Expand Down
6 changes: 3 additions & 3 deletions core/qtex/QSubprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import time
import traceback

from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

from core.interact import interact as io

Expand Down
6 changes: 3 additions & 3 deletions core/qtex/QXIconButton.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

from localization import StringsDB
from .QXMainWindow import *
Expand Down
6 changes: 3 additions & 3 deletions core/qtex/QXMainWindow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *

class QXMainWindow(QWidget):
"""
Expand Down
6 changes: 3 additions & 3 deletions core/qtex/qtex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from localization import StringsDB

from .QXMainWindow import *
Expand Down
4 changes: 2 additions & 2 deletions requirements-cuda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ scikit-image==0.14.2
scipy==1.4.1
colorama
tensorflow-gpu==2.4.0
pyqt5
tf2onnx==1.9.3
pysides6
tf2onnx==1.9.3