You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another one with shapes, as I was almost killing myself few times, why losses are throwing incompatible shapes error:
InvalidArgumentError: Incompatible shapes: [2,320,320,30] vs. [2,512,512,30]
[[node gradients_1/loss_2/softmax_loss/dice_loss_plus_1focal_loss/mul_grad/BroadcastGradientArgs (defined at /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_156811]
when all my pictures are of 512x512 size. Losses are getting 2 arguments of ground-truth and predictions, which are tensors of shapes: batch_size, image_height, image_width, classes, so the change need to be made beforehand and I think it's on the preprocessing staff.
In Keypoints dataset general class Dataset has function getItem and inside of it:
mask = _build_mask(keypoints)
# extract certain classes from mask (e.g. cars)
masks = [(mask == v) for v in self.class_values]
mask = np.stack(masks, axis=-1).astype("float")
# add background if mask is not binary
if mask.shape[-1] != 1:
background = 1 - mask.sum(axis=-1, keepdims=True)
mask = np.concatenate((mask, background), axis=-1)
# apply augmentations
if self.augmentation:
sample = self.augmentation(image=image, mask=mask)
image, mask = sample["image"], sample["mask"]
Everything looks fine, but, _build_mask_utils has some default values:
I don't know what exactly module of augumentation does, but it looks like mask is changing shape of a validation image, so when to compare against old one, incompatible shapes error is thrown.
Again yes good catch. I am very sorry I taught I removed such hardcoded shape in every training scripts...
Anyway, this should be corrected with the last commit.
Feel free to open a pull request next time haha!
Cheers
Hi,
Another one with shapes, as I was almost killing myself few times, why losses are throwing incompatible shapes error:
when all my pictures are of 512x512 size. Losses are getting 2 arguments of ground-truth and predictions, which are tensors of shapes: batch_size, image_height, image_width, classes, so the change need to be made beforehand and I think it's on the preprocessing staff.
In Keypoints dataset general class Dataset has function getItem and inside of it:
Everything looks fine, but, _build_mask_utils has some default values:
I don't know what exactly module of augumentation does, but it looks like mask is changing shape of a validation image, so when to compare against old one, incompatible shapes error is thrown.
My idea is to invoke _build_mask like so:
The text was updated successfully, but these errors were encountered: