towhee icon indicating copy to clipboard operation
towhee copied to clipboard

[Feature]: Is there any way to get towhee to support batch processing of images

Open zhenzi0322 opened this issue 3 years ago • 1 comments

Example:

import towhee


class Resnet50:
    """
    Say something about the ExampleCalass...

    Args:
        args_0 (`type`):
        ...
    """

    def resnet50_extract_feat(self, img_path):
        feat = towhee.glob(img_path) \
                     .image_decode() \
                     .image_embedding.timm(model_name='resnet50') \
                     .tensor_normalize() \
                     .to_list()
        return feat[0]

zhenzi0322 avatar Sep 15 '22 03:09 zhenzi0322

Towhee support batch interface to run the data in batch, you can refer to this. Is this interface what you want?

BTW, if you want to processing batch images, you can set the img_path as the paths matching a pathname pattern, such as towhee.glob('all_img/*.jpg', 'all_img/*.png'). And set_parallel interface will help to process image in multi parallel.

shiyu22 avatar Sep 16 '22 10:09 shiyu22

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.

stale[bot] avatar Oct 22 '22 09:10 stale[bot]