Comments (12)
Hi @Byronnar, thank you for your interest in our work.
This error is at the end of the first epoch, where in the last batch, you have only one image and BN gives an error, to solve this, please simply set drop_last = True in the dataloaders (or change the batch size / do an if statement to skip the last step if BZ = 1).
from cct.
Thank for your reply~ I have set batch_size=2 have solved this problem. But I cannot find where is the dataloaders(Except in train_cam.py), you mean in dataloader in voc.py?
from cct.
Hi @Byronnar, thank you for your interest in our work.
This error is at the end of the first epoch, where in the last batch, you have only one image and BN gives an error, to solve this, please simply set drop_last = True in the dataloaders (or change the batch size / do an if statement to skip the last step if BZ = 1).
The error below:
self.init_kwargs: 88888888 {'dataset': Dataset: VOCDataset
# data: 9118
Split: train_unsupervised
Root: /home/byronnar/bigfile/datasets/img_detection/VOCdevkit/VOC2012, 'batch_size': 1, 'shuffle': True, 'num_workers': 8, 'pin_memory': True, 'drop_last': True}
self.init_kwargs: 88888888 {'dataset': Dataset: VOCDataset
# data: 1449
Split: val
Root: /home/byronnar/bigfile/datasets/img_detection/VOCdevkit/VOC2012, 'batch_size': 1, 'shuffle': False, 'num_workers': 4, 'pin_memory': True, 'drop_last': True}
Loading pretrained model:models/backbones/pretrained/3x3resnet50-imagenet.pth
Nbr of trainable parameters: 47210776
Detected GPUs: 1 Requested: 1
0%| | 0/9118 [00:00<?, ?it/s]Traceback (most recent call last):
File "train.py", line 99, in <module>
main(config, args.resume)
File "train.py", line 83, in main
trainer.train()
File "/home/byronnar/bigfile/projects/CCT/base/base_trainer.py", line 91, in train
results = self._train_epoch(epoch)
File "/home/byronnar/bigfile/projects/CCT/trainer.py", line 75, in _train_epoch
total_loss, cur_losses, outputs = self.model(x_l=input_l, target_l=target_l, x_ul=input_ul, curr_iter=batch_idx, target_ul=target_ul, epoch=epoch-1)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
return self.module(*inputs[0], **kwargs[0])
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/home/byronnar/bigfile/projects/CCT/models/model.py", line 93, in forward
output_l = self.main_decoder(self.encoder(x_l))
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/home/byronnar/bigfile/projects/CCT/models/encoder.py", line 61, in forward
x = self.psp(x)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/home/byronnar/bigfile/projects/CCT/models/encoder.py", line 36, in forward
align_corners=False) for stage in self.stages])
File "/home/byronnar/bigfile/projects/CCT/models/encoder.py", line 36, in <listcomp>
align_corners=False) for stage in self.stages])
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward
exponential_average_factor, self.eps)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py", line 1652, in batch_norm
raise ValueError('Expected more than 1 value per channel when training, got input size {}'.format(size))
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1])
0%| | 0/9118 [00:02<?, ?it/s]
I have added the 'drop_last': True.
from cct.
Sorry, I thought you had a problem only at the end of the first epochs (multi gpu training). In your case, I think you are training with only one batch, but the nn.BatchNorm
layers expect more than one image per batch to compute the running mean. You'll need to set the batch size to be > 1.
from cct.
Sorry, I thought you had a problem only at the end of the first epochs (multi gpu training). In your case, I think you are training with only one batch, but the
nn.BatchNorm
layers expect more than one image per batch to compute the running mean. You'll need to set the batch size to be > 1.
Thanks for your reply.
I can train on VOC2012, but I don't know how to generate images in the SegmentationClassAug? I mean that unsupervised images.
Looking forward to your reply.
from cct.
from cct.
Are you trying to use it on your dataset? SegmentationClassAug is only specific for VOC2012.
from cct.
Yeah, I AM trying to use it on my dataset, but I don't know how to get the unlabeled data, it can be original RGB colorful image?
from cct.
Are you trying to use it on your dataset? SegmentationClassAug is only specific for VOC2012.
whether the custom datasets should as same as SegmentationClassAug?
from cct.
No need for SegmentationClassAug, simply use your own dataloader, you'll need to create two dataloaders, one for the supervised dataset and one for the unsupervised dataset. You can create it them any way you like (see closed issues, there is a lot of discussion on the usage of custom datasets).
from cct.
No need for SegmentationClassAug, simply use your own dataloader, you'll need to create two dataloaders, one for the supervised dataset and one for the unsupervised dataset. You can create it them any way you like (see closed issues, there is a lot of discussion on the usage of custom datasets).
Thank you! You mean don't need for image-level data? (in the paper, there arre 9k image-level data in unsupervised section.)
from cct.
I used https://github.com/wkentaro/labelme to annotate my own dataset
from cct.
Related Issues (20)
- Error in training the model
- ModuleNotFoundError: No module named 'tensorboard' HOT 1
- Cityscapes/CamVid config file HOT 2
- How to obtain figure 2(d) HOT 5
- Unsupervised data is only used to improve the performance of the Encoder part? HOT 1
- Labels for unsupervised HOT 1
- Cusom dataset with one class HOT 2
- adjusting the model for input images with 4 channels HOT 3
- Training model only on foreground labels HOT 3
- inference with 4-channel model HOT 7
- Adjust the number of decoders HOT 2
- checkerboard HOT 7
- How can I train this model using my own dataset? HOT 1
- About checkpoint HOT 1
- About loss_unsup
- dataloader HOT 1
- Errors while inferencing the trained model HOT 1
- What are the required dimensions of `predict` and `target` for abCE loss? HOT 2
- Question about the paper "Semi-Supervised Semantic Segmentation with Cross-Consistency Training" HOT 1
- Program error during training HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cct.