pysilcam/__main__.py
def loop(config_filename, inputQueue, outputQueue, gui=None):
    '''
    Main processing loop, run for each image

    Args:
        config_filename (str)   : path of the config ini file
        inputQueue  ()          : queue where the images are added for processing
                                  initilised using defineQueues()
        outputQueue ()          : queue where information is retrieved from processing
                                  initilised using defineQueues()
        gui=None (Class object) : Queue used to pass information between process thread and GUI
                                  initialised in ProcThread within guicals.py
    '''
    settings = PySilcamSettings(config_filename)
    configure_logger(settings.General)
    logger = logging.getLogger(__name__ + '.silcam_process')

    # load the model for particle classification and keep it for later

    # a tensorflow session must be started on each process in order to function reliably in multiprocess.
    # This also includes the import of tensorflow on each process
    # @todo the loading of the model and prediction functions should be within a class that is initialized by starting a
    #  tensorflow session, then this will be cleaner.
    import tensorflow as tf
    sess = tf.Session()

    nnmodel = []
    nnmodel, class_labels = sccl.load_model(model_path=settings.NNClassify.model_path)

    while True:
        task = inputQueue.get()
        if task is None:
            outputQueue.put(None)
            break
        stats_all = processImage(nnmodel, class_labels, task, settings, logger, gui)

        if (not stats_all is None):
            outputQueue.put(stats_all)
        else:
            logger.info('No stats found.')

    # close of the tensorflow session when everything is finished.
    # unsure of behaviour if things crash or are stoppped before reaching this point
    sess.close()
    return

    Main processing loop, run for each image

    Args:
        config_filename (str)   : path of the config ini file
        inputQueue  ()          : queue where the images are added for processing
                                  initilised using defineQueues()
        outputQueue ()          : queue where information is retrieved from processing
                                  initilised using defineQueues()
        gui=None (Class object) : Queue used to pass information between process thread and GUI
                                  initialised in ProcThread within guicals.py
    
Main processing loop, run for each image
Main processing loop run for each image
def loop(config_filename, inputQueue, outputQueue, gui=None):
    settings = PySilcamSettings(config_filename)
    configure_logger(settings.General)
    logger = logging.getLogger(__name__ + '.silcam_process')
    import tensorflow as tf
    sess = tf.Session()
    nnmodel = []
    nnmodel, class_labels = sccl.load_model(model_path=settings.NNClassify.model_path)
    while True:
        task = inputQueue.get()
        if task is None:
            outputQueue.put(None)
            break
        stats_all = processImage(nnmodel, class_labels, task, settings, logger, gui)
        if (not stats_all is None):
            outputQueue.put(stats_all)
        else:
            logger.info('No stats found.')
    sess.close()
    return
def loop ( config_filename , inputQueue , outputQueue , gui = None ) : settings = PySilcamSettings ( config_filename ) configure_logger ( settings . General ) logger = logging . getLogger ( __name__ + '.silcam_process' ) import tensorflow as tf sess = tf . Session ( ) nnmodel = [ ] nnmodel , class_labels = sccl . load_model ( model_path = settings . NNClassify . model_path ) while True : task = inputQueue . get ( ) if task is None : outputQueue . put ( None ) break stats_all = processImage ( nnmodel , class_labels , task , settings , logger , gui ) if ( not stats_all is None ) : outputQueue . put ( stats_all ) else : logger . info ( 'No stats found.' ) sess . close ( ) return
Main processing loop, run for each image
Main processing loop run for each image
'''
    Main processing loop, run for each image

    Args:
        config_filename (str)   : path of the config ini file
        inputQueue  ()          : queue where the images are added for processing
                                  initilised using defineQueues()
        outputQueue ()          : queue where information is retrieved from processing
                                  initilised using defineQueues()
        gui=None (Class object) : Queue used to pass information between process thread and GUI
                                  initialised in ProcThread within guicals.py
    ''' # load the model for particle classification and keep it for later # a tensorflow session must be started on each process in order to function reliably in multiprocess. # This also includes the import of tensorflow on each process # @todo the loading of the model and prediction functions should be within a class that is initialized by starting a #  tensorflow session, then this will be cleaner. # close of the tensorflow session when everything is finished. # unsure of behaviour if things crash or are stoppped before reaching this point
config_filename
path of the config ini file
path of the config ini file
inputQueue
outputQueue
gui
inputQueue  ()          
queue where the images are added for processing
initilised using defineQueues()
queue where the images are added for processing initilised using defineQueues ()
outputQueue ()          
queue where information is retrieved from processing
initilised using defineQueues()
queue where information is retrieved from processing initilised using defineQueues ()
gui=None
Queue used to pass information between process thread and GUI
initialised in ProcThread within guicals.py
Queue used to pass information between process thread and GUI initialised in ProcThread within guicals . py