Currently The K-means CLustring code is written like this in a method:
def predict(image_path):
image = cv2.imread(image_path)
image = image.reshape((image.shape[0] * image.shape[1], 3))
clt = KMeans(n_clusters = 3, random_state=2, n_jobs=1)
clt.fit(image)
How can I save This to a model so I can convert it to Core-ML and use it in my application?
Save:
pickle.dump(clt, open("save.pkl", "wb"))Load:
clt = pickle.load(open("save.pkl", "rb"))