Different detection results when running model via workflow vs. Python API

Hello everyone,

I’m reaching out for help to understand an issue I’m facing with my project.

The goal of the project is to detect small defects on surfaces.

I trained a new model and created a workflow using the SAHI method. With this setup, I get consistent results - such as the classes “impurity” and “crater”, which are the ones I trained the model on.

I also deployed the inference through a Python API by copying the provided code. However, when I run the API inference on the same image, I get completely unexpected results, like “classe 42: surfboard”, which looks like predictions from the default pretrained classes.

I previously deployed another model using the same approach and did not encounter this issue.

Has anyone experienced something similar or knows what might be causing this?

Thank you in advance!

Good afternoon @val!
My name is Ford and I am a Support Engineer at Roboflow. Happy to help here!

Before running inference on the workflow via the provided code snippet, did you set the most recent workflow live by clicking the “Publish” button?

If not, you will be running inference on an earlier version which would explain the detections that resemble predictions from the foundation model.