dvlab-research/PFENet

Problem in code

titoriya007 opened this issue · 3 comments

Please check this error
Traceback (most recent call last):
File "test.py", line 263, in
main()
File "test.py", line 86, in main
main_worker(args.train_gpu, args.ngpus_per_node, args)
File "test.py", line 144, in main_worker
loss_val, mIoU_val, mAcc_val, allAcc_val, class_miou = validate(val_loader, model, criterion)
File "test.py", line 237, in validate
allAcc = sum(intersection_meter.sum) / (sum(target_meter.sum) + 1e-10)
TypeError: 'int' object is not iterable

Hi, thanks for being interested in our work.

In my exp, there is no such error reported. Please check your dataset/config preparation.

Thank you.

MSiam commented

I am facing the same error actually. It turned out to be because the val_loader was empty it wasn't able to load any images. If you change this line in utils/dataset.py to use Image.open() instead of cv2.imread() when reading the labels it will work. For some reason cv2.imread is returning weird values for the labels probably sth related to the types being read. But Image.open doesn't have this issue.

I met the same problem. Have you solved the problem