Replies: 9 comments
-
Like as it was the binary segmentation i tried cross-entropy even for that I am getting error can anyone help to solve this problem |
Beta Was this translation helpful? Give feedback.
-
What dataloader/datamodule are you using? Can you post the code / initialization? |
Beta Was this translation helpful? Give feedback.
-
class CustomDataset(RasterDataset): def getitem(self, query):
ds = CustomDataset(data_root) i used the 76.8 becouse each is dividing by 0.3 so i get the size as torch.Size([1, 1, 256, 256]) |
Beta Was this translation helpful? Give feedback.
-
Can you print the shape of
|
Beta Was this translation helpful? Give feedback.
-
yes, the shape of the mask is torch.Size([1, 1, 256, 256]) for x in dl:
|
Beta Was this translation helpful? Give feedback.
-
I think you need to change your dataloader to return masks of size |
Beta Was this translation helpful? Give feedback.
-
Thank you soo much @calebrob6 i think it worked well |
Beta Was this translation helpful? Give feedback.
-
You're welcome! |
Beta Was this translation helpful? Give feedback.
-
But can I know why my epochs was not moving? |
Beta Was this translation helpful? Give feedback.
-
model =SemanticSegmentationTask(
segmentation_model="unet",
encoder_name="resnet18",
encoder_weights=None,
in_channels=10,
num_classes=2,
num_filters=64,
loss="jaccard",
ignore_zeros=False,
learning_rate=0.1,
learning_rate_schedule_patience=5,
)
trainer = pl.Trainer(
trainer.fit(model,dl)
Using 16bit native Automatic Mixed Precision (AMP)
GPU available: True, used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/configuration_validator.py:133: UserWarning: You defined a
validation_step
but have noval_dataloader
. Skipping val loop.rank_zero_warn("You defined a
validation_step
but have noval_dataloader
. Skipping val loop.")Missing logger folder: /content/lightning_logs
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]
| Name | Type | Params
0 | model | Unet | 14.4 M
1 | loss | JaccardLoss | 0
2 | train_metrics | MetricCollection | 0
3 | val_metrics | MetricCollection | 0
4 | test_metrics | MetricCollection | 0
14.4 M Trainable params
0 Non-trainable params
14.4 M Total params
28.701 Total estimated model params size (MB)
Epoch 0: 0%
0/4 [00:00<?, ?it/s]
ValueError Traceback (most recent call last)
in ()
21 )
22
---> 23 trainer.fit(model,dl)
36 frames
/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/checks.py in _check_shape_and_type_consistency(preds, target)
113 else:
114 raise ValueError(
--> 115 "Either
preds
andtarget
both should have the (same) shape (N, ...), ortarget
should be (N, ...)"116 " and
preds
should be (N, C, ...)."117 )
ValueError: Either
preds
andtarget
both should have the (same) shape (N, ...), ortarget
should be (N, ...) andpreds
should be (N, C, ...).Beta Was this translation helpful? Give feedback.
All reactions