ilastik / hytra

Python module for multi HYpotheses TRAcking
https://github.com/ilastik/hytra
MIT License
2 stars 7 forks source link

trackingGraph.weightsListToDict returns only 4 weights #15

Closed ilastikdev closed 7 years ago

ilastikdev commented 7 years ago

no matter what the value of withDivisions is

trackingGraph.weightsListToDict([transitionWeight, detectionWeight, divisionWeight, appearanceWeight, disappearanceWeight])

withDivisions True
INFO ilastik.applets.tracking.conservation.opConservationTracking: generating traxels
INFO ilastik.applets.tracking.conservation.opConservationTracking: fetching region features and division probabilities
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (1, 33)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.000745 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (3, 31)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.00109 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: 1.0
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: 1.0
INFO ilastik.applets.tracking.conservation.opConservationTracking: filling traxelstore
[====================] 100%
[====================] 100%
INFO ilastik.applets.tracking.structured.opStructuredTracking: Structured Learning: Adding Training Annotations to Hypotheses Graph
INFO ilastik.applets.tracking.structured.opStructuredTracking: max nearest neighbors=
[====================] 100%
inintialWeights {'weights': [0.01, 0.6, 0.3, 0.2]}
************************
Settings are:
    StatesShareWeights: true
    AllowPartialMergerAppearance: false
    AllowLengthOneTracks: false
    RequireSeparateChildrenOfDivision: true
    NonNegativeWeightsOnly: false
    OptimizerEpGap: 0.005
    OptimizerVerbose: true
    OptimizerNumThreads: 1
************************
    contains 0 segmentation hypotheses
    contains 0 linking hypotheses
Provided length of vector with initial weights has wrong length!
ERROR 2016-12-09 13:52:41,627 log_exception 6322 140393793619776 Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/projectManager.py", line 443, in _loadProject
    self.workflow.onProjectLoaded( self )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 438, in onProjectLoaded
    self.batchProcessingApplet.run_export_from_parsed_args(self._batch_input_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 60, in run_export_from_parsed_args
    return self.run_export(role_path_dict, parsed_args.input_axes)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 121, in run_export
    export_to_array=export_to_array )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 223, in _run_export_with_empty_batch_lane
    self.dataExportApplet.prepare_lane_for_export(batch_lane_index)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 342, in prepare_lane_for_export
    withBatchProcessing=True)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 333, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Provided length of vector with initial weights has wrong length!

ERROR 2016-12-09 13:52:41,628 log_exception 6322 140393793619776 Project could not be loaded due to the exception shown above.
Aborting Project Open Action
E
======================================================================
ERROR: testStructuredLearningTrackingHytraWithMergers.TestStructuredLearningTrackingHeadless.testStructuredLearningTrackingHeadless
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/lazyflow/lazyflow/utility/timer.py", line 142, in wrapper
    return func(*args, **kwargs)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/tests/test_applets/structuredLearningTracking/testStructuredLearningTrackingHytraWithMergers.py", line 114, in testStructuredLearningTrackingHeadless
    self.ilastik_startup.main()
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/../ilastik.py", line 108, in main
    ilastik_main.main(parsed_args, workflow_cmdline_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik_main.py", line 102, in main
    f(shell)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik_main.py", line 317, in loadProject
    shell.openProjectFile(path, parsed_args.readonly)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/headless/headlessShell.py", line 116, in openProjectFile
    self.projectManager._loadProject(hdf5File, projectFilePath, readOnly)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/lazyflow/lazyflow/utility/timer.py", line 142, in wrapper
    return func(*args, **kwargs)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/projectManager.py", line 443, in _loadProject
    self.workflow.onProjectLoaded( self )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 438, in onProjectLoaded
    self.batchProcessingApplet.run_export_from_parsed_args(self._batch_input_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 60, in run_export_from_parsed_args
    return self.run_export(role_path_dict, parsed_args.input_axes)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 121, in run_export
    export_to_array=export_to_array )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 223, in _run_export_with_empty_batch_lane
    self.dataExportApplet.prepare_lane_for_export(batch_lane_index)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 342, in prepare_lane_for_export
    withBatchProcessing=True)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 333, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Provided length of vector with initial weights has wrong length!
ilastikdev commented 7 years ago

mht.trainWithWeightInitialization(model,gt, initialWeights)

fails with 5 weights and withDivisions=True

withDivisions True
INFO ilastik.applets.tracking.conservation.opConservationTracking: generating traxels
INFO ilastik.applets.tracking.conservation.opConservationTracking: fetching region features and division probabilities
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (1, 33)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.001015 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (3, 31)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.003052 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: 1.0
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: 1.0
INFO ilastik.applets.tracking.conservation.opConservationTracking: filling traxelstore
[====================] 100%
[====================] 100%
INFO ilastik.applets.tracking.structured.opStructuredTracking: Structured Learning: Adding Training Annotations to Hypotheses Graph
INFO ilastik.applets.tracking.structured.opStructuredTracking: max nearest neighbors=
[====================] 100%
inintialWeights {'weights': [0.01, 0.6, 0.6, 0.3, 0.2]}
************************
chaubold commented 7 years ago

I'm pretty confident that the method itself does what it is supposed to (it passes its test https://github.com/chaubold/hytra/blob/master/tests/core/test_jsongraph.py#L469).

This seems to be more a problem of your model, which appears to be completely empty, as you can see in those lines of your log:

************************
    contains 0 segmentation hypotheses
    contains 0 linking hypotheses
ilastikdev commented 7 years ago

similar thing happens even if the model is not empty, division classifier is trained, and withDivisions is on:

inintialWeights {'weights': [0, 0, 0.0, 0, 0]}
************************
Settings are:
    StatesShareWeights: true
    AllowPartialMergerAppearance: false
    AllowLengthOneTracks: false
    RequireSeparateChildrenOfDivision: true
    NonNegativeWeightsOnly: false
    OptimizerEpGap: 0.005
    OptimizerVerbose: true
    OptimizerNumThreads: 1
************************
    contains 18 segmentation hypotheses
    contains 35 linking hypotheses
Provided length of vector with initial weights has wrong length!
ERROR 2016-12-14 16:27:45,278 excepthooks 15815 140204825524032 Unhandled exception in thread: 'MainThread'
ERROR 2016-12-14 16:27:45,278 excepthooks 15815 140204825524032 Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/structuredTrackingGui.py", line 366, in _onRunStructuredLearningButtonPressed
    withBatchProcessing)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 347, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Provided length of vector with initial weights has wrong length!
chaubold commented 7 years ago

Is this still a problem?