slash-segmentation / CHM

Cascaded Hierarchical Model Automatic Segmentation Algorithm
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

global variable 'method' not found when running chm train #30

Closed coleslaw481 closed 7 years ago

coleslaw481 commented 7 years ago

I just tried to run a train using pychm_singularity image and got this exception:

2017-09-13 17:09:10 Training stage 1 level 0...
2017-09-13 17:09:10   Extracting features...
2017-09-13 17:09:16   Learning...
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib64/python2.7/site-packages/chm-0.1-py2.7-linux-x86_64.egg/chm/train.py", line 519, in <module>
    __chm_train_main()
  File "/usr/lib64/python2.7/site-packages/chm-0.1-py2.7-linux-x86_64.egg/chm/train.py", line 318, in __chm_train_main
    out = CHM_train(ims, lbls, model, subsamples, masks, nthreads)
  File "/usr/lib64/python2.7/site-packages/chm-0.1-py2.7-linux-x86_64.egg/chm/train.py", line 73, in CHM_train
    sm.learn(X, Y, nthreads=nthreads) # TODO: the disp method should using the logging module
  File "/usr/lib64/python2.7/site-packages/chm-0.1-py2.7-linux-x86_64.egg/chm/model.py", line 418, in learn
    if method != 'none' and method is not None:
NameError: global name 'method' is not defined

Looking at the code in model.py it looks like the variable method cannot be found in evaluate() or in learn().

To replicate checkout code from chris_method_bug branch (commit: 488be59fc1684da82265403ab21ba67a9f37d924) on a Centos 7 linux machine with Singularity 2.2+ installed and working and from within pychm_singularity run this:

git clone .... 
cd CHM
git branch chris_method_bug
cd pychm_singularity
make clean singularity