提交 7009c507 编写于 作者: qq_25193841's avatar qq_25193841

Update joinus.png and PPOCRLabel

上级 1d52345b
...@@ -92,7 +92,7 @@ class WindowMixin(object): ...@@ -92,7 +92,7 @@ class WindowMixin(object):
class MainWindow(QMainWindow, WindowMixin): class MainWindow(QMainWindow, WindowMixin):
FIT_WINDOW, FIT_WIDTH, MANUAL_ZOOM = list(range(3)) FIT_WINDOW, FIT_WIDTH, MANUAL_ZOOM = list(range(3))
def __init__(self, lang="ch", defaultFilename=None, defaultPrefdefClassFile=None, defaultSaveDir=None): def __init__(self, lang="ch", gpu=False, defaultFilename=None, defaultPrefdefClassFile=None, defaultSaveDir=None):
super(MainWindow, self).__init__() super(MainWindow, self).__init__()
self.setWindowTitle(__appname__) self.setWindowTitle(__appname__)
...@@ -108,7 +108,7 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -108,7 +108,7 @@ class MainWindow(QMainWindow, WindowMixin):
getStr = lambda strId: self.stringBundle.getString(strId) getStr = lambda strId: self.stringBundle.getString(strId)
self.defaultSaveDir = defaultSaveDir self.defaultSaveDir = defaultSaveDir
self.ocr = PaddleOCR(use_pdserving=False, use_angle_cls=True, det=True, cls=True, use_gpu=False, lang=lang) self.ocr = PaddleOCR(use_pdserving=False, use_angle_cls=True, det=True, cls=True, use_gpu=gpu, lang=lang)
if os.path.exists('./data/paddle.png'): if os.path.exists('./data/paddle.png'):
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True) result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
...@@ -1239,6 +1239,8 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -1239,6 +1239,8 @@ class MainWindow(QMainWindow, WindowMixin):
def loadFile(self, filePath=None): def loadFile(self, filePath=None):
"""Load the specified file, or the last opened file if None.""" """Load the specified file, or the last opened file if None."""
if self.dirty:
self.mayContinue()
self.resetState() self.resetState()
self.canvas.setEnabled(False) self.canvas.setEnabled(False)
if filePath is None: if filePath is None:
...@@ -2037,6 +2039,8 @@ def read(filename, default=None): ...@@ -2037,6 +2039,8 @@ def read(filename, default=None):
except: except:
return default return default
def str2bool(v):
return v.lower() in ("true", "t", "1")
def get_main_app(argv=[]): def get_main_app(argv=[]):
""" """
...@@ -2048,13 +2052,14 @@ def get_main_app(argv=[]): ...@@ -2048,13 +2052,14 @@ def get_main_app(argv=[]):
app.setWindowIcon(newIcon("app")) app.setWindowIcon(newIcon("app"))
# Tzutalin 201705+: Accept extra agruments to change predefined class file # Tzutalin 201705+: Accept extra agruments to change predefined class file
argparser = argparse.ArgumentParser() argparser = argparse.ArgumentParser()
argparser.add_argument("--lang", default='en', nargs="?") argparser.add_argument("--lang", type=str, default='en', nargs="?")
argparser.add_argument("--gpu", type=str2bool, default=False, nargs="?")
argparser.add_argument("--predefined_classes_file", argparser.add_argument("--predefined_classes_file",
default=os.path.join(os.path.dirname(__file__), "data", "predefined_classes.txt"), default=os.path.join(os.path.dirname(__file__), "data", "predefined_classes.txt"),
nargs="?") nargs="?")
args = argparser.parse_args(argv[1:]) args = argparser.parse_args(argv[1:])
# Usage : labelImg.py image predefClassFile saveDir # Usage : labelImg.py image predefClassFile saveDir
win = MainWindow(lang=args.lang, win = MainWindow(lang=args.lang, gpu=args.gpu,
defaultPrefdefClassFile=args.predefined_classes_file) defaultPrefdefClassFile=args.predefined_classes_file)
win.show() win.show()
return app, win return app, win
......
doc/joinus.PNG

99.7 KB | W: | H:

doc/joinus.PNG

101.8 KB | W: | H:

doc/joinus.PNG
doc/joinus.PNG
doc/joinus.PNG
doc/joinus.PNG
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册