NoelShin / PixelPick

[ICCVW'21] All you need are a few pixels: semantic segmentation with PixelPick
https://www.robots.ox.ac.uk/~vgg/research/pixelpick/
MIT License
65 stars 16 forks source link

Question about random initialization for 0th query #5

Closed won-bae closed 3 years ago

won-bae commented 3 years ago

Hi,

I have a question about random initialization for 0th query. I may totally misunderstand your implementation but do not quite understand why you randomly initialize two different queries for self.dataloader and self.dataloader_query separately. If this is the case, wouldn't it be possible that a model labels a pixel in one of self.dataloader images that has already been labeled through random initialization since 0th labels for self.dataloader and self.dataloader_query are different? Is there any particular reason why you maintain two different queries? Thank you.

NoelShin commented 3 years ago

Dear Won Bae,

Thanks for your query and I think it's a good question!

(1) The reason why we used two separate dataloaders is related to the different data augmentation settings (although it still is possible to use a single dataloader instance instead of two). That is, when querying, we do not apply any augmentation and consider pure data while when training, data augmentation is used. Just to make sure we didn't apply augmentation for query data, we used a separate dataloader (i.e. self.dataloader_query).

(2) About the concern if the two dataloaders have different queries, I could confirm that they share the same queried labels by putting the below lines at the end of __init__ of Model class in model.py file and running the implementation script. (This is because we fix the seed before sampling pixels.)

import numpy as np
print((self.dataloader.dataset.queries == self.dataloader_query.dataset.queries).all())

I believe this concern is raised because the sampling process for 0th query repeats twice (for self.dataloader and self.dataloader_query) on CamVid and PASCAL VOC2012 datasets. As it's not necessary to do so, I updated the code so that the sampling does not repeat. :)

I hope this answer will help. Noel

won-bae commented 3 years ago

Hi Noel,

Thank you for the quick reply. Now I understand the reasoning behind it. The reason why I opened this issue was that I observed the number of labeled pixels in dataloader is less than that in dataloader_query by 1 pixel as shown in the below which I believe is very rare but also unexpected (I don't know why it happens given that the random seed is fixed). Anyway, it seems your simple modification elegantly resolves the issue. Thank you :)

Screen Shot 2021-07-12 at 9 10 31 PM