philkr / lpo

Implementation of the CVPR 2015 paper: Learning to propose objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

analyze_model.py raises division by zero (with demonstration models)

rodrigob opened this issue · comments

When running analyze_model.py (with python 2.7) over the demonstratation model, I get a division by zero.

python analyze_model.py ../models/lpo_VOC_0.1.dat 
/home/rodrigob/.local/lib/python2.7/site-packages/numpy/core/_methods.py:55: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
/home/rodrigob/.local/lib/python2.7/site-packages/numpy/core/_methods.py:67: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
Traceback (most recent call last):
  File "analyze_model.py", line 115, in <module>
    evaluateDetailed( prop, over_segs, segmentations )
  File "analyze_model.py", line 101, in evaluateDetailed
    print( names[m], '&', np.mean(ps[m]), '&', np.mean(bo[m]>=bbo)*100, '&', np.sqrt(np.mean(ma[m])), '&', t[m]/len(ma[m]) )
ZeroDivisionError: integer division or modulo by zero

I am not getting this right from the help and readme ?

Same happens if I use a model created via

python train_lpo.py -f0 0.1 ../models/test_model_VOC_0.1.dat
Setting up the model
('Training', 0.1)

It seems the VOC dataset is not loaded properly. The dataset script silently ignores any files it cannot read, hence you get an empty dataset (0 images and 0 proposals) which leads to a division by 0. #7 is probably related to this.
I added a quick check to make sure that the dataset loads properly in be67fef. Just delete any VOC2012_*_mssf_1000.dat files you have in your tmp directory and rerun.

Perfect, that was it. Fixing the data_dir path made it.