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

你好,我这地方不太理解,您方便解答一下吗? #11

Open
liubaoning111 opened this issue Dec 7, 2024 · 2 comments
Open

Comments

@liubaoning111
Copy link

Uploading 微信图片_20241207164245.png…

此处的dataset=labeled_train_set引用的是有标记的数据,但是dataset=train_set却还是总的数据集,为什么不是unlabeled_train_set呢?

@liubaoning111
Copy link
Author

train_set = ISICDataset(image_path=args.data_path, stage='train', image_size=args.image_size, is_augmentation=True) #1045
labeled_train_set, unlabeled_train_set = random_split(train_set, [int(len(train_set) * args.labeled_percentage),   ## 1045,  52, 
                                                   len(train_set) - int(len(train_set) * args.labeled_percentage)]) # 1045,  993个无标记的样本 
print('before:', len(labeled_train_set), len(train_set))   #52个有标记的样本  
# repeat the labeled set to have a equal length with the unlabeled set (dataset)
labeled_ratio = len(train_set) // len(labeled_train_set)  ##20倍
labeled_train_set = ConcatDataset([labeled_train_set for i in range(labeled_ratio)])  #翻倍20次  变成1040
labeled_train_set = ConcatDataset([labeled_train_set,
                                   Subset(labeled_train_set, range(len(train_set) - len(labeled_train_set)))])
assert len(labeled_train_set) == len(train_set)
print('after:', len(labeled_train_set), len(train_set))
train_labeled_dataloder = DataLoader(dataset=labeled_train_set, num_workers=args.num_workers, batch_size=args.batch_size, shuffle=True, pin_memory=True)
train_unlabeled_dataloder = DataLoader(dataset=train_set, num_workers=args.num_workers, batch_size=args.batch_size, shuffle=True, pin_memory=True)是这些代码中的

@Senyh
Copy link
Owner

Senyh commented Dec 10, 2024

将全集作为无标注数据集,使一致性正则能够利用全部数据

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