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

Add fp32 to in8 conversion notebook. Removed imread-from-url library dependency. Minor fixes #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mokshmalik5757
Copy link

@mokshmalik5757 mokshmalik5757 commented Aug 5, 2024

I have made some minor fixes in your code. Changed .gitignore file extension. Removed imread-from-url dependency and created a custom function using requests library for reading images from URL. Fixed the requirements.txt. Changed function in sam2/utils.py.

@ibaiGorordo
Copy link
Owner

ibaiGorordo commented Aug 6, 2024

Thank you for trying to improve the code.

In my case I get Error 403, when trying to get the image. The error disappears using this instead:

ua = UserAgent()
header = {'User-Agent': str(ua.chrome)}
response = requests.get(img_url, headers=header)

After fixing that though, the if img: check returns ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

SInce I don't mind the imread_from_url dependency, if you roll back that part I would appreciate it.

@mokshmalik5757
Copy link
Author

I have reverted back the changes with "imread_from_url" dependency, and I have also fixed the error ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() while executing the if image check.

@mokshmalik5757
Copy link
Author

I'd also like to suggest that you should add the notebook for converting the PyTorch model of SAM 2 to ONNX in the notebooks directory that I've created, that way, one would be able to reference all the conversion code in a single directory.

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