Add dim check while calculating mIoU&pixAcc for segmentation test#991
Add dim check while calculating mIoU&pixAcc for segmentation test#991chunhanl wants to merge 4 commits intodmlc:masterfrom
Conversation
|
Apologies for the new spaces, it was automatically modified by Pycharm IDE |
|
Job PR-991-1 is done. |
| evaluating the models (VOC results are evaluated using the official server). For example ``fcn_resnet50_ade``:: | ||
|
|
||
| python test.py --dataset ade20k --model-zoo fcn_resnet50_ade --eval | ||
| python test.py --dataset ade20k --pretrained --model fcn --backbone resnet50 --eval |
There was a problem hiding this comment.
why make this change?
There was a problem hiding this comment.
Hello,
According in test.py
gluon-cv/scripts/segmentation/test.py
Line 20 in a78965f
The args defined in parse_args() no longer has args 'model-zoo'
There was a problem hiding this comment.
Please add that back instead. Not sure who removed that.
There was a problem hiding this comment.
I'm not sure whether this may have conflicts with these settings.
gluon-cv/scripts/segmentation/test.py
Lines 204 to 230 in a78965f
| # inputs are NDarray, output 4D, target 3D | ||
| # add new axis if missing batch dimension | ||
| # the category -1 is ignored class, typically for background / boundary | ||
| if len(output.shape) == 3: |
There was a problem hiding this comment.
batch_intersection_union is supposed to work for a batch with 4D.
There was a problem hiding this comment.
OK I'll try to modify from the dataset
|
Job PR-991-2 is done. |
| for i, (data, dsts) in enumerate(tbar): | ||
| if args.eval: | ||
| predicts = [pred[0] for pred in evaluator.parallel_forward(data)] | ||
| predicts = [pred for pred in evaluator.parallel_forward(data)] |
There was a problem hiding this comment.
This is incorrect. The output of gluoncv segmentation network is always a list


The test.py example mentioned at
segmentation.rst
does not match the arguments mentioned in test.py
should probably be change to
python test.py --dataset ade20k --pretrained --model fcn --backbone resnet50 --evalThe dimension doesn't seem right when calculating the pixACC and mIoU
The output is 3D and the target is 2D
The safest way I could think of is to add a new axis if batch dim is missing.
Might have a better way to deal with.
Result after modification (without training)
