roboflow-python icon indicating copy to clipboard operation
roboflow-python copied to clipboard

predict() for URLs sets image_dims to "Undefined"

Open saschwarz opened this issue 2 years ago • 2 comments

When calling model.predict('https://example.com/test.jpg) with a URL the response contains:

results.image_dims
{'width': 'Undefined', 'height': 'Undefined'}

Which is unfortunate since the Roboflow server (or inference library) is calculating the width/height in order to return bounding boxes in image coordinates.

This would be helpful, so library users don't have to also download the image to calculate it's width/height.

saschwarz avatar Apr 29 '23 15:04 saschwarz

Hi @saschwarz , could you give more information about your code? For example, what model you are using?

arijitde92 avatar Jul 06 '23 14:07 arijitde92

Hi, im getting the same problem! Im using this code:

import roboflow rf = roboflow.Roboflow(api_key="API KEY") project = rf.workspace().project("project_name") model = project.version("3").model model.confidence = 50 model.overlap = 25 prediction = model.predict("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP0tioviW9kWX3mS7lx1j91E7yQuKJ_35nE_YlkrNJRk8nqVT4ypFNL3gTkVbE0u1K6DNhOlZ6hjk3wFLDLQN9NjikoLiIhpiz-gO_AfmMyqqBd5N2ovfeWnPNixrTqpaCu9uyq8XlOHY/s320/The+BASIC+floor+plan+of+the+cabin.jpg") prediction.plot() print(prediction.json())

Its a private dataset model for instance segmentation that i'm working with. Has this problem been solved?

Example of prediction:

], 'class_id': 2, 'detection_id': '8f069845-cb28-45f1-a67e-74f1b66a352c', 'image_path': 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP0tioviW9kWX3mS7lx1j91E7yQuKJ_35nE_YlkrNJRk8nqVT4ypFNL3gTkVbE0u1K6DNhOlZ6hjk3wFLDLQN9NjikoLiIhpi z-gO_AfmMyqqBd5N2ovfeWnPNixrTqpaCu9uyq8XlOHY/s320/The+BASIC+floor+plan+of+the+cabin.jpg', 'prediction_type': 'InstanceSegmentationModel' } ], 'image': {'width': 'Undefined', 'height': 'Undefined'} }

Mapa0 avatar Oct 01 '24 22:10 Mapa0