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

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1]) #34

Closed
meshghi opened this issue Mar 30, 2021 · 1 comment

Comments

@meshghi
Copy link

meshghi commented Mar 30, 2021

Hello,

I tried to use my customized dataset with image size 256x256 and 12 classes. I'm not using your VOC.py and dataloader codes. I am using my own dataloaders as follows but I get this error after some iterations:

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1]) T (1) | Ls 2.51 Lu 0.00 Lw 0.00 PW 0.00 m1 0.04 m2 0.04|: 1%|▍ | 20/1894 [00:11<18:32, 1.68it/s]

Dataloaders in train.py file:

` num_classes = 12

supervised_data = SLD_Labeled()
other_data = SLD_Unlabeled()


labeled_percentage = 0.2
all_data_size = len(other_data)
labeled_size = math.ceil(labeled_percentage * all_data_size)
unlabeled_size = all_data_size - labeled_size
unsupervised_data, val_data = random_split(other_data, [unlabeled_size, labeled_size])

supervised_loader = DataLoader(dataset=supervised_data,
                                batch_size=4,
                                shuffle=True,
                                )

unsupervised_loader = DataLoader(dataset=unsupervised_data,
                                batch_size=4,
                                shuffle=True,
                                )

val_loader = DataLoader(dataset=val_data,
                        batch_size=4,
                        shuffle=False,
                        )`
@SuzannaLin
Copy link
Contributor

Check Solved Issues #28

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

3 participants