qubvel / segmentation_models.pytorch

Semantic segmentation models with 500+ pretrained convolutional and transformer-based backbones.
https://smp.readthedocs.io/
MIT License
9.1k stars 1.62k forks source link

data preproccessing : mask = to_tensor #859

Open raidanis opened 3 months ago

raidanis commented 3 months ago

my masks shape is (512, 512), when i start the fitting i get an error of miss matching axes , i think the problem is here :

def to_tensor(x, kwargs):

return x.transpose(2, 0, 1).astype('float32')**

the function expect input of 3 dimentions not 2 , any one can help ??

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

qubvel commented 1 month ago

Hi, you can just expand the last dim, x[..., None]

raidanis commented 1 month ago

I fix it but , I'm facing problems in deployment with flask , can you help sir?

On Thu, May 9, 2024, 10:18 Pavel Iakubovskii @.***> wrote:

Hi, you can just expand the last dim, x[..., None]

— Reply to this email directly, view it on GitHub https://github.com/qubvel/segmentation_models.pytorch/issues/859#issuecomment-2102281494, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANFN64DNKGIJ26EU4IGW77DZBM5PTAVCNFSM6AAAAABEOCDKFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBSGI4DCNBZGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

qubvel commented 1 month ago

You can ask a question, if I have an answer I will help :)