-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 SAM2CameraPredictor #124
Conversation
Hi @Gy920! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Could you add a sample notebook showing this running on a video stream? Webcam or open cv VideoReader? |
@Gy920 How to use this? It may be great if an example is given. |
I have added the notebook and instructions on how to use it. |
@Gy920 In the examples of using SAM2CameraPredictor, the frame (which is in BGR?) from cap.read() may need to be converted to RGB first. |
My bad, I didn't catch that. |
@Gy920 Never mind, it is still a great job after correction. I have checked that it works for streaming (frame-by-frame), but I found that the performance is worse than SAM2VideoPredictor.propagate_in_video() used in video_predictor_example.ipynb. . In some frames, part of the mask of the object is missing when using with SAM2CameraPredictor.track(), while it is good when using SAM2VideoPredictor.propagate_in_video(). What's the difference between them in inference? In addition, only "add_new_points" is supported. Would it be possible to support "add_new_boxes" in SAM2CameraPredictor? |
I have a hunch the issue might be tied to the part simplified during implementation. That could explain the drop in tracking performance.And thanks for the heads-up on add_new_boxes, I'll definitely add that to SAM2CameraPredictor. I'm a bit swamped at the moment, but I'll carve out some time to dig into this issue and get it sorted as soon as possible. |
Run Segment Anything Model 2 on a live video stream