def filter_prediction(predictions, treshhold):
    """
    Removes prediction where scores < threshold
    :param predictions:
    ``List[Dict[Tensor]]`` The fields of the ``Dict`` are as follows:
        - boxes (``FloatTensor[N, 4]``)
        - labels (``Int64Tensor[N]``)
        - scores (``Tensor[N]``)
        * optional
        - masks (``UInt8Tensor[N, 1, H, W]``)
    :param treshhold: ``float``, threshold
    :return: the same predictions without scores < threshold
    """
    samples = []
    for i, prediction in enumerate(predictions):
        tresh = len([x for x in predictions[i]['scores'] if x >= treshhold])
        sample = {
            'boxes': prediction['boxes'][:tresh].cpu(),
            'labels': prediction['labels'][:tresh].cpu(),
            'scores': prediction['scores'][:tresh].cpu(),
        }

        if 'masks' in prediction:
            sample['masks'] = prediction['masks'][:tresh].cpu()

        samples.append(sample)

    return samples