-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix segmentation testing and support CPU #888
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,8 +130,8 @@ def test(model, args, input_transform): | |
im_paths = dsts | ||
predicts = evaluator.parallel_forward(data) | ||
for predict, impath in zip(predicts, im_paths): | ||
predict = mx.nd.squeeze(mx.nd.argmax(predict[0], 1)).asnumpy() + \ | ||
testset.pred_offset | ||
predict = mx.nd.squeeze(mx.nd.argmax(predict, 1), axis=0).\ | ||
asnumpy() + testset.pred_offset | ||
mask = get_color_pallete(predict, args.dataset) | ||
outname = os.path.splitext(impath)[0] + '.png' | ||
mask.save(os.path.join(outdir, outname)) | ||
|
@@ -194,6 +194,7 @@ def benchmarking(model, args): | |
|
||
if __name__ == "__main__": | ||
args = parse_args() | ||
args.test_batch_size = max(1, args.ngpus) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just want to know why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the review! I have removed this line, and I will update the code later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the review! I have removed this line, and I will update the code later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why the program gets stuck. I will check it later. |
||
logging.basicConfig() | ||
logger = logging.getLogger('logger') | ||
logger.setLevel(logging.INFO) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break existing segmentation model, which outputs a list by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the elements in the list
predict
?I think
predicts
is a list ofNDArray
, andpredict
is aNDArray
whose shape is(1, num_cls, height, width)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
predicts is a list of list of NDArray
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I will check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhanghang1989
Hi, I found the type of
predicts
istuple
, and the type ofpredict
isNDArray
.Test script:
python test.py --dataset pascal_voc --model-zoo psp_resnet101_voc