kaixin96 / PANet

Code for our ICCV 2019 paper PANet: Few-Shot Image Semantic Segmentation with Prototype Alignment
321 stars 64 forks source link

Some questions about the dataloader #6

Closed lailvlong closed 2 years ago

lailvlong commented 4 years ago

https://github.com/kaixin96/PANet/blob/c248b2542e2ae1906d11c85b493bc9000773d5fd/dataloaders/common.py#L155-L159

In this sample operation, the 'k' is set to be 'n_elements'. I think the 'k' here should be the number of class, but 'n_elements' is the number of images per class. Is it wrong?

kaixin96 commented 4 years ago

Hi @lailvlong,

This line is actually not used. Sorry, the data loading code is a little bit messy. n_elements here is expected to be an integer.

For all experiments, code in line 147 is used instead.

Hope this clarifies. Thank you.

kaixin96 commented 4 years ago

I plan to update the data loading part using torchmeta. Stay tuned :)

lailvlong commented 4 years ago

Hi @lailvlong,

This line is actually not used. Sorry, the data loading code is a little bit messy. n_elements here is expected to be an integer.

For all experiments, code in line 147 is used instead.

Hope this clarifies. Thank you.

thanks for your replying!

kaixin96 commented 4 years ago

update: rewriting data loading in torchmeta is on my todo list but currently not top 1, sorry :(

You may want to subscribe to this issue.

lailvlong commented 4 years ago

https://github.com/kaixin96/PANet/blob/39815f7546f34d6b1055865a4b323c1da6984524/dataloaders/customized.py#L206-L208 Hello! According to my comprehension, the _nelements here is the number of the selected images per class and it should change in every sample. However, it is fixed. Does it matter?

kaixin96 commented 4 years ago

Hi @lailvlong , you are right. The number of selected images per class is fixed. But it is ok because the order of the classes is random. https://github.com/kaixin96/PANet/blob/39815f7546f34d6b1055865a4b323c1da6984524/dataloaders/common.py#L148-L149 For example, considering a 2-way 5-shot task on the first split, n_elements could be [5, 6] (n_queries=1). These numbers do not correspond to particular classes. The classes sampled could be [bicycle, boat] or [boat, bicycle].

Hope this clarifies.

Thank you.

lailvlong commented 4 years ago

Hi @lailvlong , you are right. The number of selected images per class is fixed. But it is ok because the order of the classes is random. https://github.com/kaixin96/PANet/blob/39815f7546f34d6b1055865a4b323c1da6984524/dataloaders/common.py#L148-L149

For example, considering a 2-way 5-shot task on the first split, n_elements could be [5, 6] (n_queries=1). These numbers do not correspond to particular classes. The classes sampled could be [bicycle, boat] or [boat, bicycle]. Hope this clarifies.

Thank you.

Yes, i get what you mean. However, when the _nqueries != 1, it will matter. For example, in a 2-way 1-shot task and _nqueries == 5, the ramdom function fix the _nelements to be [3,4], then the _nelements is always [3,4] but never to be [1,6] and [2,5].

kaixin96 commented 4 years ago

Yes, that's a bug. Thanks for pointing it out. I missed the n_queries != 1 case.

Meoooww commented 2 years ago

I plan to update the data loading part using torchmeta. Stay tuned :)

Did you update? I don't see it in the code (22.07.16)Thank you very much for your update maintenance

kaixin96 commented 2 years ago

@Meoooww I no longer work on few shot segmentation and will not update it, sorry.