-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feat/add instance segmentation #67
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Test Results 6 files 6 suites 1h 39m 49s ⏱️ Results for commit d47253a. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments, otherwise LGTM
n = len(images) | ||
|
||
for i in range(n): | ||
boxes = boxes_batch[i].tolist() | ||
if len(boxes) == 0: | ||
final_segments.append([]) | ||
continue | ||
|
||
inputs = self.processor( | ||
images[i], input_boxes=[boxes], return_tensors="pt" | ||
).to(self.device) | ||
|
||
with torch.no_grad(): | ||
outputs = self.model(**inputs, return_dict=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SlimSAM doesn't support batched inference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that each image can have different number of detected objects, and in that case the batched inference isn't possible straight away , so that's why I implemented it per image. But now that you've mentioned it, I thought about it again and realized that we could "padd" the bboxes with dummy bboxes, so that we can have batch inference, I'm currrently testing it. Let me know @sokovninn, if you'd find this small hack better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Dummy bboxes is a good solution. However, I am not sure if it will bring any boost in inference speed, but it is worth a try I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, I'll test it and let you know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turned out not to be faster, so not gonna use it.
This PR includes adding the option to generate an instance-segmentation dataset.
It includes: