def run(self):

        #set enviornment
        os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
        os.environ["CUDA_VISIBLE_DEVICES"] = str(self._gpuid)

        #load models
        import wingdbstub
        wingdbstub.Ensure()
        wingdbstub.debugger.StartDebug()
        import vgg16
        #download the vgg16 weights from
        #https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5
        xnet = vgg16.Vgg16(
            '/media/zhaoke/b0685ee4-63e3-4691-ae02-feceacff6996/models/vgg16_weights_tf_dim_ordering_tf_kernels.h5'
        )

        print 'vggnet init done', self._gpuid

        while True:
            xfile = self._queue.get()
            if xfile == None:
                self._queue.put(None)
                break
            label = self.predict(xnet, xfile)
            print 'woker', self._gpuid, ' xfile ', xfile, " predicted as label", label

        print 'vggnet done ', self._gpuid
        wingdbstub.debugger.StopDebug()
Esempio n. 2
0
def get_word_dict(recognizer, img_box, bounding_box, q, id_):
    if id_ == 0:
        import wingdbstub
        wingdbstub.Ensure()
        wingdbstub.debugger.StartDebug()
    if len(img_box.shape) >= 3:
        img_box = np.dot(img_box[...,:3], [0.299, 0.587, 0.114])
        img_box = img_box.astype(np.uint8)
    result = recognizer.infer_line([img_box])
    print(id_, ' done!')
    q.put((result, bounding_box, id_))
    if id_ == 0:
        wingdbstub.debugger.Stop()
    return True
Esempio n. 3
0
def connectToWing():
    """
    SYNOPSIS
     Connects to wingIDE debugger
    
    INPUTS NONE
    
    RETURNS: Nothing
    """
    import wingdbstub
    try:
        wingdbstub.Ensure()
        print 'Connected to wingIDE'
    except ValueError:
        print 'Could NOT connect to wingIDE'
def reconnect():

    #try to import wing
    import wingdbstub
    wingdbstub.Ensure()

    import time
    try:
        debugger = wingdbstub.debugger
    except AttributeError:
        print "No debugger found!"
    else:
        if debugger is not None:
            debugger.StopDebug()
            time.sleep(1)
            debugger.StartDebug()
Esempio n. 5
0
 def start(self, workers=5):
     try:
         while len(self.paths):
             import wingdbstub
             wingdbstub.Ensure()
             wingdbstub.debugger.StartDebug()
             self._get_ret()
             for i in self._threads.keys():
                 if self._threads[i] is None and len(self.paths):
                     thread = multiprocessing.Process(target=get_word_dict,
                                                      args=(
                                                          self.paths.pop(),
                                                          self.queue,
                                                          i,
                                                      ))
                     thread.daemon = True
                     self._threads[i] = thread
                     thread.start()
             wingdbstub.debugger.StopDebug()
         self._get_ret()
         self.stop()
     except:
         self.stop()
         raise
Esempio n. 6
0
def StartDebug():
    import wingdbstub
    wingdbstub.Ensure()
Esempio n. 7
0
    Email                : franke at ggr-planung dot de
***************************************************************************
*                                                                         *
*   This program is free software: you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 3 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************

initializes the plugin, makes it known to QGIS
'''

__author__ = 'Christoph Franke'
__date__ = '16/07/2019'
__copyright__ = 'Copyright 2019, HafenCity University Hamburg'

# debugging in WingIDE
try:
    import wingdbstub
    wingdbstub.Ensure()
except:
    pass

# noinspection PyPep8Naming
def classFactory(iface):  # pylint: disable=invalid-name
    # initialize the settings
    from .settings import settings
    from .ProjektCheck import ProjektCheck
    return ProjektCheck(iface)