How to calculate precision for tensors of different sizes during detection?

I train SSDLite320 from the detection module in pytorch and the model gives me predicted labels of length n, and the targetets have length k. But I get the following error:
ValueError: Either preds and target should both have the (same) shape (N, …), or target should be (N, …) and preds should be (N, C, …).
What to do to fix it? Thank you in advance. I am using torchmetrics.