-
Notifications
You must be signed in to change notification settings - Fork 77
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
NotImplementedError #341
Comments
Indeed - there is a bug in the example. Could u tell what you wanted to achieve - we can guide you towards the solution |
Thank you for your prompt response. I am looking to deploy Sam's inference on my local GPU and subsequently execute sequential inference on the images within the designated folder, saving the results. |
Ok, so there are couple of options. You can run our inference server start That should start docker container with our server (you can confirm via Then you can send requests either to embed image or segment it: import requests
API_KEY = "<YOUR-ROBOFLOW-API-KEY>" # see https://docs.roboflow.com/api-reference/authentication for help
infer_payload = {
"image": {
"type": "url",
"value": "https://t3.ftcdn.net/jpg/01/73/37/16/360_F_173371622_02A2qGqjhsJ5SWVhUPu0t9O9ezlfvF8l.jpg", # this is an example image
},
"point_coords": [[380, 350]], # this is example input
"point_labels": [1], # this is example input
"image_id": "example_image_id", # this is example input - if you use single image multiple times, use uuids for to recognise images - then we will use cache
}
res = requests.post(
f"http://127.0.0.1:9001/sam/segment_image?api_key={API_KEY}",
json=infer_payload,
)
masks = res.json() Alternatively, you can modify example to be something like that: import cv2
from inference.models import SegmentAnything
YOUR_IMAGE = cv2.imread("<path-to-your-image>")
model = SegmentAnything(api_key="<YOUR-ROBOFLOW-API-KEY>")
inference_results = model.segment_image(
image=YOUR_IMAGE,
point_coords=[[380, 350]],
point_labels=[1],
image_id="...",
)
# then do whatever you need with prediction |
You can find API ref. for the model class here |
Search before asking
Question
When I was running this code (main/examples/sam-client/app.py), this error occurred, what could be the cause? I set
--image_path
to "./cat.jpg"Traceback (most recent call last):
File "/home/z/deeplearning/roboflow/test3.py", line 42, in
inference_results = model.infer(image_path)
File "/home/z/anaconda3/envs/inference1/lib/python3.10/site-packages/inference/core/models/base.py", line 23, in infer
preproc_image, returned_metadata = self.preprocess(image, **kwargs)
File "/home/z/anaconda3/envs/inference1/lib/python3.10/site-packages/inference/core/models/base.py", line 35, in preprocess
raise NotImplementedError
NotImplementedError
Additional
No response
The text was updated successfully, but these errors were encountered: