-
Notifications
You must be signed in to change notification settings - Fork 793
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
Update PSPNet and ICNet #81
Conversation
… is uint8 with RGB mode
Thank you for your nice implementations. |
@adam9500370 - Thanks for the PR! Could you update the PR to have the ICNet as well? It'd be great to have ICNet in the suite as well. |
ptsemseg/loss.py
Outdated
for i in range(nt): | ||
lbl_resized[i,:,:] = m.imresize(lbl[i,:,:], (h, w), 'nearest', mode='F') | ||
lbl_resized = lbl_resized.astype(int) | ||
target = Variable(torch.from_numpy(lbl_resized).long().cuda()) |
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.
Perhaps it would be faster if we used torch.nn.functional.upsample_nearest
instead of scipy imresize
.
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.
I will rewrite this part and update ICNet.
I will create auxiliary loss function for PSPNet and ICNet, and model outputs adjusted by training or eval mode to make train.py, validate.py, and test.py scripts clean).
data_loader = get_loader(args.dataset) | ||
data_path = get_data_path(args.dataset) | ||
loader = data_loader(data_path, is_transform=True) | ||
loader = data_loader(data_path, is_transform=True, img_norm=args.img_norm) |
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 the test script for all other dataloaders, which don't have the img_norm
argument.
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.
Since I just add this arg in cityscapes dataloader, I will add it in other dataloaders.
Looks good to me, need to make very minor some changes in the dataloader to incorporate the Looking forward to the ICNet Implementation!. I will merge asap. |
Update:
Pretrained models: |
Hi adam9500370, thanks for sharing. Could you please also share how you trained those PSPnet and ICNet models? |
Hi, @nichalin . |
Got it. Thanks, @adam9500370. |
Hi !!! @nichalin Did you do the crop prediction to get 78.80 mIOU /96.34 |
OK, I found the reason, because I use the latest pytorch, I need to set align_corners=True to get your answer, I will do the crop test |
@adam9500370 @meetshah1995 @lxtGH I met the following problem:
May I ask about how much GPU memory is needed to conduct full resolution inference? Thx |
@erichhhhho I guess you should inference with the code like this: |
Thank you!! |
@lxtGH @adam9500370 @meetshah1995 I think the performance gap is mainly because the inference method. It is related to the sliding prediction scheme discussed here Has anyone tried this before? |
Modifications:
Validation results on cityscapes validation set (mIoU/pAcc):
Without flip: 78.65/96.31
With flip: 78.80/96.34
I feed images into network input size: 1025x2049 and single scale (since model input is odd numbers (713x713))
Run on single GTX 1080TI, time is about 1.2~1.3 fps
python validate.py --model_path checkpoints/pspnet_101_cityscapes.pth --dataset cityscapes --img_rows 1025 --img_cols 2049 --no-img_norm --eval_flip --measure_time --batch_size 2 --split val
Pretrained models in pytorch:
pspnet_50_ade20k.pth
pspnet_101_cityscapes.pth
pspnet_101_pascalvoc.pth