roboflow / roboflow/roboflow-python

Wrong Roboflow return result after prediction

Open
#154 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
629
Forks
140
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Hi
I am trying out the api to return the result. The result of the bounding box seem to be off despite when I do the roboflow save action to save the image to visualize the bounding box. The save action shows the correct position of the bounding box but not the return result. Any advice?

predict = model.predict("test.jpg", confidence=40, overlap=0).json()
gives when the python return the json result:

{'x': 508.5, 'y': 212.5, 'width': 263.0, 'height': 225.0, 'confidence': 0.9291292428970337, 'class': 'car', 'image_path': 'test.jpg', 'prediction_type': 'ObjectDetectionModel'}
{'x': 233.0, 'y': 164.0, 'width': 40.0, 'height': 34.0, 'confidence': 0.8354455232620239, 'class': 'car', 'image_path': 'test.jpg', 'prediction_type': 'ObjectDetectionModel'}
{'x': 347.5, 'y': 173.0, 'width': 53.0, 'height': 146.0, 'confidence': 0.7597783803939819, 'class': 'person', 'image_path': 'test.jpg', 'prediction_type': 'ObjectDetectionModel'}

whereas if i drop the image into the roboflow ui to do the detection, using confidence level of 40 and overlap of 0, on the roboflow ui , it is
{
"predictions": [
{
"x": 406.5,
"y": 170,
"width": 211,
"height": 180,
"confidence": 0.929,
"class": "car"
},
{
"x": 277.5,
"y": 138.5,
"width": 43,
"height": 117,
"confidence": 0.84,
"class": "person"
},
{
"x": 186.5,
"y": 131.5,
"width": 31,
"height": 27,
"confidence": 0.784,
"class": "car"
}
]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the model.predict("test.jpg", confidence=40, overlap=0).json() call and reproduce the reported coordinates for test.jpg. Compare those results with the Roboflow UI output and the saved visualization, then determine why the bounding boxes differ. Done means the API and UI results agree for this reproduction or the discrepancy is documented with a clear resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.