BGNet icon indicating copy to clipboard operation
BGNet copied to clipboard

TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Open WkangLiu opened this issue 3 years ago • 3 comments

When I replay eval.py I get the following error when test the : 'maxFm': 0.7736841486165681} 63%|██████▎ | 2605/4121 [06:05<02:38, 9.59it/s][ WARN:[email protected]] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('./results/BGNet/NC4K/429.png'): can't open/read file: check file path/integrity 63%|██████▎ | 2606/4121 [06:05<03:32, 7.13it/s] Traceback (most recent call last): File "/ssdhome/qzb521/abc/BGNet/eval.py", line 30, in FM.step(pred=pred, gt=mask) File "/home/qzb521/miniconda3/envs/sinet/lib/python3.9/site-packages/py_sod_metrics/sod_metrics.py", line 65, in step pred, gt = _prepare_data(pred, gt) File "/home/qzb521/miniconda3/envs/sinet/lib/python3.9/site-packages/py_sod_metrics/sod_metrics.py", line 23, in _prepare_data pred = pred / 255 TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

It maybe not generate the predict image before eval it? What's wrong with this error?

WkangLiu avatar Nov 09 '22 12:11 WkangLiu

When I replay eval.py I get the following error when test the : 'maxFm': 0.7736841486165681} 63%|██████▎ | 2605/4121 [06:05<02:38, 9.59it/s][ WARN:[email protected]] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('./results/BGNet/NC4K/429.png'): can't open/read file: check file path/integrity 63%|██████▎ | 2606/4121 [06:05<03:32, 7.13it/s] Traceback (most recent call last): File "/ssdhome/qzb521/abc/BGNet/eval.py", line 30, in FM.step(pred=pred, gt=mask) File "/home/qzb521/miniconda3/envs/sinet/lib/python3.9/site-packages/py_sod_metrics/sod_metrics.py", line 65, in step pred, gt = _prepare_data(pred, gt) File "/home/qzb521/miniconda3/envs/sinet/lib/python3.9/site-packages/py_sod_metrics/sod_metrics.py", line 23, in _prepare_data pred = pred / 255 TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

It maybe not generate the predict image before eval it? What's wrong with this error?

If you want to generate images for testing, please run etest.py. The eval.py is used to calculate evaluation indicators. Before running eval.py, make sure that there are images in pre_root.

thograce avatar Nov 10 '22 02:11 thograce

Thanks! This is an oversight on my part.

WkangLiu avatar Nov 10 '22 02:11 WkangLiu

Thanks! This is an oversight on my part.

By the way, you can download my test result image directly from pre-computed maps of BGNet, and then run eval.py.

thograce avatar Nov 10 '22 02:11 thograce