arthurdouillard / CVPR2021_PLOP

Official code of CVPR 2021's PLOP: Learning without Forgetting for Continual Semantic Segmentation
https://arxiv.org/abs/2011.11390
MIT License
143 stars 23 forks source link

predict and visualization #27

Closed Liuhao-128 closed 2 years ago

Liuhao-128 commented 2 years ago

Describe the bug Hi , I have one question about how to predict a picture when finish the training stage, in other words, how to visualize the segmentation results in your code. I have written a simple visualization .py file, but when I load the model , I found that the model did not load successfully. If it's convenient, I would appreciate it if you could share your predict code. We look forward to your answer, thanks

To Reproduce

Dataset: voc-2012 Setting: 19-1 Command used or script used:

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

arthurdouillard commented 2 years ago

Hey, thank for youur interest in our work :)

Please look at this issue https://github.com/arthurdouillard/CVPR2021_PLOP/issues/17, I think it is what you're looking for right?

Liuhao-128 commented 2 years ago

thanks for your answer. actually, today I also setting the args.visulization =True and samples_number =10, the visualization results of the val_dataset on the tensorboard are available, I will try this code(issue https://github.com/arthurdouillard/CVPR2021_PLOP/issues/17) as soon as possible, thanks again!

Liuhao-128 commented 2 years ago

Hi, I have run the predict.py file in issue #17, and get the results, the detail in the attachment, but i have some questions about that code. 1 this code confused me --old_model.module.in_eval = True, I commented directly since there is no old module to import or instance. 2 the Target part has an error in this code: --target[~mask] = 0 , and i don't understand the function of this part. if i want visualize the final validation on voc dataset in task 19-1, Could you explain it to me how to setting the , thanks , the detail in attachment picture--error code

error-code

arthurdouillard commented 2 years ago

Hum, it depends on your version of pytorch I think for the mask.

Try casting the mask as boolean (target[~mask.bool()] = 0) or byte (target[~mask.byte()] = 0).

Try this command:

python3 viz.py --dataset voc --task 19-1 --step 1 --ckpt my_model.pth --indexes 0 100 500 1000 1245 1277 1330 1355 1425 1447 --name my_name

I think it should work :)