Traceback (most recent call last):
Traceback (most recent call last):
File "traininglightning.py", line 54, in
trainer.fit(model, train_loader, val_loader)
File "trainer.py", line 538, in fit
call._call_and_handle_interrupt(
File "call.py", line 47, in _call_and_handle_interrupt
return trainer_fn(*args, kwargs)
File "trainer.py", line 574, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "trainer.py", line 981, in _run
results = self._run_stage()
File "trainer.py", line 1023, in _run_stage
self._run_sanity_check()
File "trainer.py", line 1052, in _run_sanity_check
val_loop.run()
File "utilities.py", line 178, in _decorator
return loop_run(self, *args, kwargs)
File "evaluation_loop.py", line 135, in run
self._evaluation_step(batch, batch_idx, dataloader_idx, dataloader_iter)
File "evaluation_loop.py", line 396, in _evaluation_step
output = call._call_strategy_hook(trainer, hook_name, step_args)
File "call.py", line 319, in _call_strategy_hook
output = fn(args, kwargs)
File "strategy.py", line 411, in validation_step
return self.lightning_module.validation_step(*args, kwargs)
File "traininglightningfunc.py", line 166, in validationstep
outputs, = self(images.float())
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, *kwargs)
File "traininglightningfunc.py", line 151, in forward
return self.model(x)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, kwargs)
File "model.py", line 39, in forward
decoder_output = self.decoder(features)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, *kwargs)
File "decoder.py", line 122, in forward
x = decoder_block(x, skip)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, **kwargs)
...
RuntimeError: Given groups=1, expected weight to be at least 1 at dimension 0, but got weight of size [0, 4, 1, 1] instead.
I don't understand? my input is two-channel, 512 by 512
I'm trying to train a UNet as shown in documentation, but I got an error relating to input shape?
Here is my code:
encoder = 'timm-resnest14d' aux_params = { 'classes': 3, # Example: 2 classes for binary segmentation 'pooling': 'max', # Use average pooling 'dropout': 0.5, # 50% dropout 'activation': 'identity' # Softmax activation for multi-class output } self.model = smp.Unet(encoder_name=encoder, encoder_depth=5, decoder_use_batchnorm = False, decoder_attention_type = 'scse', decoder_channels = [4, 16, 32, 64, 128], encoder_weights='imagenet', in_channels=2, classes = 3, activation = 'identity', aux_params = aux_params)
My error:
Traceback (most recent call last): Traceback (most recent call last): File "traininglightning.py", line 54, in
trainer.fit(model, train_loader, val_loader)
File "trainer.py", line 538, in fit
call._call_and_handle_interrupt(
File "call.py", line 47, in _call_and_handle_interrupt
return trainer_fn(*args, kwargs)
File "trainer.py", line 574, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "trainer.py", line 981, in _run
results = self._run_stage()
File "trainer.py", line 1023, in _run_stage
self._run_sanity_check()
File "trainer.py", line 1052, in _run_sanity_check
val_loop.run()
File "utilities.py", line 178, in _decorator
return loop_run(self, *args, kwargs)
File "evaluation_loop.py", line 135, in run
self._evaluation_step(batch, batch_idx, dataloader_idx, dataloader_iter)
File "evaluation_loop.py", line 396, in _evaluation_step
output = call._call_strategy_hook(trainer, hook_name, step_args)
File "call.py", line 319, in _call_strategy_hook
output = fn(args, kwargs)
File "strategy.py", line 411, in validation_step
return self.lightning_module.validation_step(*args, kwargs)
File "traininglightningfunc.py", line 166, in validationstep
outputs, = self(images.float())
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, *kwargs)
File "traininglightningfunc.py", line 151, in forward
return self.model(x)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, kwargs)
File "model.py", line 39, in forward
decoder_output = self.decoder(features)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, kwargs)
File "module.py", line 1747, in _call_impl
return forward_call(*args, *kwargs)
File "decoder.py", line 122, in forward
x = decoder_block(x, skip)
File "module.py", line 1736, in _wrapped_call_impl
return self._call_impl(args, **kwargs)
...
RuntimeError: Given groups=1, expected weight to be at least 1 at dimension 0, but got weight of size [0, 4, 1, 1] instead.
I don't understand? my input is two-channel, 512 by 512