Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update factory.py to work for batch of images #4

Merged
merged 3 commits into from
Nov 24, 2024

Conversation

cerebrai
Copy link
Contributor

Description

The current implementation supports sending one image at a time. In some applications, sending a batch of images through the model and leveraging the GPU capabilities to speed up the processing would be useful. I have made slight modifications to the "forward" function in "factory.py" in the "models" folder. Now it accepts a single image or a list of images and do batch processing.

Tests

I tested it using the following code and it checks out
import cv2
import onepose

if __name__ == "__main__":
   
    model = onepose.create_model("ViTPose+_base_coco_wholebody")
    img1 = cv2.imread('/path/to/image1')
    img2 = cv2.imread('/path/to/image2')
    
    batch_img = [img1, img2]
    keypoints = model(img1)
    keypoints_batch = model(batch_img)

@developer0hye
Copy link
Owner

developer0hye commented Nov 24, 2024

Hello @cerebrai,

Great suggestion, I will check it.

@developer0hye developer0hye merged commit 7f78d0f into developer0hye:main Nov 24, 2024
2 checks passed
@developer0hye
Copy link
Owner

@cerebrai It is merged! Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants