Search code examples
pythonimagemodelorange

How to feed embedded image in Orange model?


How can I feed an image into a trained model without the GUI?

The model I've trained in Orange consists of image embedding using squeezenet to classify images of dogs and cats with Logistic Regression

Here's the code I've tried:


from orangecontrib.imageanalytics.image_embedder import ImageEmbedder
import pickle
import numpy as np

model = pickle.load(open("model.pkcls", "rb"))

embedder = ImageEmbedder(model="squeezenet")

print(model.predict(np.array(embedder(["image.jpg"]))))



Also, if possible, is there any way to feed an image from opencv instead of filepath?

enter image description here


Solution

  • Turns out i was saving the model in the wrong way.

    This was the correct workflow

    enter image description here

    I did not needed to change the code

    I couldn't find a way to load it with opencv tough