Skip to content
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

How to retain the original labels of test/train targets? #157

Open
srvCodes opened this issue Mar 13, 2022 · 2 comments
Open

How to retain the original labels of test/train targets? #157

srvCodes opened this issue Mar 13, 2022 · 2 comments

Comments

@srvCodes
Copy link

srvCodes commented Mar 13, 2022

Hi,

I have been trying to retain the original labels of test/train set targets, for example, the targets in lines 45 and 50 in the protonet training script. Could you please help?

By original labels, I refer to the integer labels before the targets get mapped to the [0, n_way-1] range during few-shot training.

@vivektrivedy
Copy link

Any update on this? @srvCodes

@vivektrivedy
Copy link

vivektrivedy commented Apr 14, 2022

For the existing datasets we can simply pass in target_transform = None to access the original labels.

from torchmeta.datasets.helpers import cifar_fs
from torchmeta.utils.data import BatchMetaDataLoader

cfs = cifar_fs('data', shots=5, ways=5, test_shots=5, meta_train=True, download=True, target_transform = None)
dataloader = BatchMetaDataLoader(cfs, batch_size=1,shuffle=False)

To check:

sample = next(iter(dataloader))
original_labels = sample['train'][1][0][1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants