1

Context: I am training a Yolov8 model and have successfully registered it in MlFlow.

The model that is used for object detection supports input in the following formats:

  1. a string form of NumPy array (obtained after opening the image with OpenCV) cv2.imread('path')
  2. directly the image path

I am using it in a similar fashion when I load the model from the MLFlow registry and do predictions.

from ultralytics import YOLO

class YOLOWrapper(mlflow.pyfunc.PythonModel):
    def load_context(self, context):
        from ultralytics import YOLO
        self.model = YOLO(context.artifacts["yolo_model"])

    def predict(self, context, model_input):
        results = self.model(model_input)
        return results

def main():

    loaded_model = mlflow.pyfunc.load_model(
            model_uri=f"models:/{registered_model_name}/latest"
        )
    
    results = loaded_model.predict(model_input = 'path to an image')

However, when I want to serve this model after registering it, I am not able to directly pass in the image in similar formats

I need help finding References in which image classification or object detection models are served usin mlflow.

I tried this but it did not work for me, so any other related suggestions would be helpful.

Mike B
  • 2,136
  • 2
  • 12
  • 31
  • Can you please also add the error messages you are receiving? It is difficult to understand exactly what is going wrong without having them. – A-T Feb 22 '23 at 15:39
  • Hey, I just want some good references where the process to serve an image model using mlflow is demonstrated. – atharva parikh Feb 23 '23 at 10:05
  • I also want some reference where the process to server image model using mlflow is explain. If you have any then please share it. – Hiral Talsaniya Aug 18 '23 at 17:59

0 Answers0