Skip to content

Image batch support #8

@Kentskooking

Description

@Kentskooking

Seems to only be working with single images, works great with video if you add batch detection in def process_image

def process_image(self, input_image):
    # Check if we've received a batch of images
    batch_mode = False
    batch_size = 1
    
    if isinstance(input_image, torch.Tensor) and input_image.dim() == 4:
        batch_size = input_image.shape[0]
        batch_mode = batch_size > 1
    
    # For single image case, keep the original logic
    if not batch_mode:
        if isinstance(input_image, torch.Tensor):
            if input_image.dim() == 4:
                input_image = input_image[0]

            if input_image.dim() == 3:
                input_image = input_image.permute(2, 0, 1)

            input_image = self.to_pil(input_image)

I used claude, so can't guarantee the quality of this solution but it does seem to work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions