def test_combined_confidence_and_class_filtering(self, sample_boxes):
        """Test filtering based on both confidence and class IDs."""
        # Set confidence threshold to 0.6 and classes_to_keep to [1, 3]
        filter = BoxFiltering(confidence_threshold=0.6, classes_to_keep=tensor([1, 3]))
        filtered_boxes = filter(sample_boxes)

        # Expected output: only boxes with confidence > 0.6 and class_id in [1, 3] should be kept
        assert len(filtered_boxes[0]) == 2  # Two boxes in the first batch
        assert filtered_boxes[0][0][0].item() == 1  # Class_id 1
        assert filtered_boxes[0][1][0].item() == 3  # Class_id 3
        assert filtered_boxes[1][0][0].item() == 1  # Class_id 1
        assert len(filtered_boxes[1]) == 1  # No boxes in the second batch
        assert len(filtered_boxes[2]) == 0  # No boxes in the third batch
Test filtering based on both confidence and class IDs.
tests/models/box_filtering.py