コード例 #1
0
    def __init__(self, *args, **kwargs):
        super(OpTrainPixelwiseClassifierBlocked,
              self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()

        # Normally, lane removal does not trigger a dirty notification.
        # But in this case, if the lane contained any label data whatsoever,
        #  the classifier needs to be marked dirty.
        # We know which slots contain (or contained) label data because they have
        # been 'touched' at some point (they became dirty at some point).
        self._touched_slots = set()

        def handle_new_lane(multislot, index, newlength):
            def handle_dirty_lane(slot, roi):
                self._touched_slots.add(slot)

            multislot[index].notifyDirty(handle_dirty_lane)

        self.Labels.notifyInserted(handle_new_lane)

        def handle_remove_lane(multislot, index, newlength):
            # If the lane we're removing contained
            # label data, then mark the downstream dirty
            if multislot[index] in self._touched_slots:
                self.Classifier.setDirty()
                self._touched_slots.remove(multislot[index])

        self.Labels.notifyRemove(handle_remove_lane)
コード例 #2
0
    def __init__(self, *args, **kwargs):
        super(OpTrainClassifierBlocked, self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()
        self._mode = None

        # Fully connect the vectorwise training operator
        self._opVectorwiseTrain = OpTrainVectorwiseClassifierBlocked(
            parent=self)
        self._opVectorwiseTrain.Images.connect(self.Images)
        self._opVectorwiseTrain.Labels.connect(self.Labels)
        self._opVectorwiseTrain.ClassifierFactory.connect(
            self.ClassifierFactory)
        self._opVectorwiseTrain.nonzeroLabelBlocks.connect(
            self.nonzeroLabelBlocks)
        self._opVectorwiseTrain.MaxLabel.connect(self.MaxLabel)
        self._opVectorwiseTrain.progressSignal.subscribe(self.progressSignal)

        # Fully connect the pixelwise training operator
        self._opPixelwiseTrain = OpTrainPixelwiseClassifierBlocked(parent=self)
        self._opPixelwiseTrain.Images.connect(self.Images)
        self._opPixelwiseTrain.Labels.connect(self.Labels)
        self._opPixelwiseTrain.ClassifierFactory.connect(
            self.ClassifierFactory)
        self._opPixelwiseTrain.nonzeroLabelBlocks.connect(
            self.nonzeroLabelBlocks)
        self._opPixelwiseTrain.MaxLabel.connect(self.MaxLabel)
        self._opPixelwiseTrain.progressSignal.subscribe(self.progressSignal)
コード例 #3
0
    def __init__(self, *args, **kwargs):
        super(OpTrainVectorwiseClassifierBlocked, self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()
        
        self._opFeatureMatrixCaches = OperatorWrapper( OpFeatureMatrixCache, parent=self )
        self._opFeatureMatrixCaches.LabelImage.connect( self.Labels )
        self._opFeatureMatrixCaches.FeatureImage.connect( self.Images )
        
        self._opConcatenateFeatureMatrices = OpConcatenateFeatureMatrices( parent=self )
        self._opConcatenateFeatureMatrices.FeatureMatrices.connect( self._opFeatureMatrixCaches.LabelAndFeatureMatrix )
        self._opConcatenateFeatureMatrices.ProgressSignals.connect( self._opFeatureMatrixCaches.ProgressSignal )
        
        self._opTrainFromFeatures = OpTrainClassifierFromFeatureVectors( parent=self )
        self._opTrainFromFeatures.ClassifierFactory.connect( self.ClassifierFactory )
        self._opTrainFromFeatures.LabelAndFeatureMatrix.connect( self._opConcatenateFeatureMatrices.ConcatenatedOutput )
        self._opTrainFromFeatures.MaxLabel.connect( self.MaxLabel )
        
        self.Classifier.connect( self._opTrainFromFeatures.Classifier )

        # Progress reporting
        def _handleFeatureProgress( progress ):
            # Note that these progress messages will probably appear out-of-order.
            # See comments in OpFeatureMatrixCache
            logger.debug("Training: {:02}% (Computing features)".format(int(progress)))
            self.progressSignal( 0.8*progress )
        self._opConcatenateFeatureMatrices.progressSignal.subscribe( _handleFeatureProgress )
        
        def _handleTrainingComplete():
            logger.debug("Training: 100% (Complete)")
            self.progressSignal( 100.0 )
        self._opTrainFromFeatures.trainingCompleteSignal.subscribe( _handleTrainingComplete )
コード例 #4
0
    def __init__(self, *args, **kwargs):
        super(OpBatchIoSelective, self).__init__(*args, **kwargs)

        self.Dirty.meta.shape = (1, )
        self.Dirty.meta.dtype = bool
        self.OutputDataPath.meta.shape = (1, )
        self.OutputDataPath.meta.dtype = object
        self.ExportResult.meta.shape = (1, )
        self.ExportResult.meta.dtype = object

        # Provide default values
        self.ExportDirectory.setValue('')
        self.Format.setValue(ExportFormat.H5)
        self.Suffix.setValue('_results')
        self.Dirty.setValue(True)

        self.progressSignal = OrderedSignal()
        self.ProgressSignal.setValue(self.progressSignal)

        self._createDirLock = threading.Lock()

        #make a cache of the input image not to request too much
        self.ImageCache = OpBlockedArrayCache(parent=self)
        self.ImageCache.fixAtCurrent.setValue(False)
        self.ImageCache.Input.connect(self.ImageToExport)
コード例 #5
0
    def __init__(self, *args, **kwargs):
        super(OpTrainCounter, self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()
        self._svr = SVR()
        params = self._svr.get_params()
        self.initInputs(params)
        self.Classifier.meta.dtype = object
        self.Classifier.meta.shape = (self.numRegressors, )

        # Normally, lane removal does not trigger a dirty notification.
        # But in this case, if the lane contained any label data whatsoever,
        #  the classifier needs to be marked dirty.
        # We know which slots contain (or contained) label data because they have
        # been 'touched' at some point (they became dirty at some point).
        self._touched_slots = set()

        def handle_new_lane(multislot, index, newlength):
            def handle_dirty_lane(slot, roi):
                self._touched_slots.add(slot)

            multislot[index].notifyDirty(handle_dirty_lane)

        self.ForegroundLabels.notifyInserted(handle_new_lane)
        self.BackgroundLabels.notifyInserted(handle_new_lane)

        def handle_remove_lane(multislot, index, newlength):
            # If the lane we're removing contained
            # label data, then mark the downstream dirty
            if multislot[index] in self._touched_slots:
                self.Classifier.setDirty()
                self._touched_slots.remove(multislot[index])

        self.ForegroundLabels.notifyRemove(handle_remove_lane)
        self.BackgroundLabels.notifyRemove(handle_remove_lane)
コード例 #6
0
    def __init__(self, *args, **kwargs):
        super(OpTrainVectorwiseClassifierBlocked, self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()
        
        self._opFeatureMatrixCaches = OperatorWrapper( OpFeatureMatrixCache, parent=self )
        self._opFeatureMatrixCaches.LabelImage.connect( self.Labels )
        self._opFeatureMatrixCaches.FeatureImage.connect( self.Images )
        self._opFeatureMatrixCaches.NonZeroLabelBlocks.connect( self.nonzeroLabelBlocks )
        
        self._opConcatenateFeatureMatrices = OpConcatenateFeatureMatrices( parent=self )
        self._opConcatenateFeatureMatrices.FeatureMatrices.connect( self._opFeatureMatrixCaches.LabelAndFeatureMatrix )
        self._opConcatenateFeatureMatrices.ProgressSignals.connect( self._opFeatureMatrixCaches.ProgressSignal )
        
        self._opTrainFromFeatures = OpTrainClassifierFromFeatureVectors( parent=self )
        self._opTrainFromFeatures.ClassifierFactory.connect( self.ClassifierFactory )
        self._opTrainFromFeatures.LabelAndFeatureMatrix.connect( self._opConcatenateFeatureMatrices.ConcatenatedOutput )
        self._opTrainFromFeatures.MaxLabel.connect( self.MaxLabel )
        
        self.Classifier.connect( self._opTrainFromFeatures.Classifier )

        # Progress reporting
        def _handleFeatureProgress( progress ):
            self.progressSignal( 0.8*progress )
        self._opConcatenateFeatureMatrices.progressSignal.subscribe( _handleFeatureProgress )
        
        def _handleTrainingComplete():
            self.progressSignal( 100.0 )
        self._opTrainFromFeatures.trainingCompleteSignal.subscribe( _handleTrainingComplete )
コード例 #7
0
 def __init__(self, *args, **kwargs):
     super(OpTrainCounter, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
     self._svr = SVR()
     params = self._svr.get_params()
     self.initInputs(params)
     self.Classifier.meta.dtype = object
     self.Classifier.meta.shape = (self.numRegressors,)
コード例 #8
0
    def __init__(self, *args, **kwargs):
        super(OpTrainSupervoxelClassifierBlocked, self).__init__(*args, **kwargs)
        self.progressSignal = OrderedSignal()
        self._mode = None

        # Fully connect the vectorwise training operator
        self._opVectorwiseTrain = OpTrainSupervoxelwiseClassifierBlocked(parent=self)
        self._opVectorwiseTrain.Images.connect(self.Images)
        self._opVectorwiseTrain.SupervoxelSegmentation.connect(self.SupervoxelSegmentation)
        self._opVectorwiseTrain.SupervoxelFeatures.connect(self.SupervoxelFeatures)
        self._opVectorwiseTrain.SupervoxelLabels.connect(self.SupervoxelLabels)
        self._opVectorwiseTrain.Labels.connect(self.Labels)
        self._opVectorwiseTrain.ClassifierFactory.connect(self.ClassifierFactory)
        self._opVectorwiseTrain.progressSignal.subscribe(self.progressSignal)
コード例 #9
0
    def __init__(self, *args, **kwargs):
        super(OpBatchIo, self).__init__(*args, **kwargs)

        self._opExportedImageProvider = None

        self.Dirty.meta.shape = (1, )
        self.Dirty.meta.dtype = bool
        self.OutputDataPath.meta.shape = (1, )
        self.OutputDataPath.meta.dtype = object
        self.ExportResult.meta.shape = (1, )
        self.ExportResult.meta.dtype = object

        # Default to Dirty
        self.Dirty.setValue(True)

        self.progressSignal = OrderedSignal()
        self.ProgressSignal.setValue(self.progressSignal)

        self._createDirLock = threading.Lock()
コード例 #10
0
    def __init__(self, *args, **kwargs):
        super(OpBatchIo, self).__init__(*args, **kwargs)

        self.Dirty.meta.shape = (1, )
        self.Dirty.meta.dtype = bool
        self.OutputDataPath.meta.shape = (1, )
        self.OutputDataPath.meta.dtype = object
        self.ExportResult.meta.shape = (1, )
        self.ExportResult.meta.dtype = object

        # Provide default values
        self.ExportDirectory.setValue('')
        self.Format.setValue(ExportFormat.H5)
        self.Suffix.setValue('_results')
        self.Dirty.setValue(True)

        self.progressSignal = OrderedSignal()
        self.ProgressSignal.setValue(self.progressSignal)

        self._createDirLock = threading.Lock()
コード例 #11
0
ファイル: ioOperators.py プロジェクト: maximka48/ilastik
    def __init__(
        self,
        h5N5File=None,
        h5N5Path=None,
        Image=None,
        BatchSize: int = None,
        CompressionEnabled: bool = None,
        *args,
        **kwargs,
    ):
        super().__init__(*args, **kwargs)

        self.progressSignal = OrderedSignal()
        self.d = None
        self.f = None

        self.h5N5File.setOrConnectIfAvailable(h5N5File)
        self.h5N5Path.setOrConnectIfAvailable(h5N5Path)
        self.Image.setOrConnectIfAvailable(Image)
        self.BatchSize.setOrConnectIfAvailable(BatchSize)
        self.CompressionEnabled.setOrConnectIfAvailable(CompressionEnabled)
コード例 #12
0
ファイル: clusterOps.py プロジェクト: emilmelnikov/ilastik
 def __init__(self, *args, **kwargs):
     super(OpTaskWorker, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
     self._primaryBlockwiseFileset = None
コード例 #13
0
 def __init__(self, *args, **kwargs):
     super(OpTrainPixelwiseClassifierBlocked, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
コード例 #14
0
 def __init__(self, *args, **kwargs):
     super(OpTrainClassifierBlocked, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
     self._mode = None
     self._training_op = None
コード例 #15
0
ファイル: ioOperators.py プロジェクト: maximka48/ilastik
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
コード例 #16
0
ファイル: ioOperators.py プロジェクト: maximka48/ilastik
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
     self.opStackLoader = OpStackLoader(parent=self)
     self.opStackLoader.globstring.connect(self.GlobString)
コード例 #17
0
 def __init__(self, *args, **kwargs):
     super(OpStackWriter, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
コード例 #18
0
 def __init__(self, *args, **kwargs):
     super(OpTrainClassifierFromFeatureVectorsAndSupervoxelMask,
           self).__init__(*args, **kwargs)
     self.trainingCompleteSignal = OrderedSignal()
コード例 #19
0
 def __init__(self, *args, **kwargs):
     super(OpH5WriterBigDataset, self).__init__(*args, **kwargs)
     self.progressSignal = OrderedSignal()
     self.d = None
     self.f = None