Plugin to train and make computer vision predictions using machine learning models.
pip install numpy)
pip install cv2)
Also make sure that your OpenCV installation comes with the
dnnmodule. To test it:
>>> import cv2.dnn
Initialize self. See help(type(self)) for accurate signature.
predict(img, model_file, classes=None, resize=None, color_convert=None)¶
Make predictions for an input image using a model file. Supported model formats include all the types supported by cv2.dnn (currently supported: Caffe, TensorFlow, Torch, Darknet, DLDT).
model_file – Path to the model file
img – Path to the image
classes – List of string labels associated with the output values (e.g. [‘negative’, ‘positive’]). If not set then the index of the output neuron with highest value will be returned.
resize – Tuple or list with the resize factor to be applied to the image before being fed to the model (default: None)
color_convert – Color conversion to be applied to the image before being fed to the model. It points to a cv2 color conversion constant (e.g.
cv2.COLOR_BGR2GRAY) and it can be either the constant value itself or a string (e.g. ‘COLOR_BGR2GRAY’).