f"The size({h}, {w}) of CropImage must be greater than size({img_h}, {img_w}) of image. Please check image original size and size of ResizeImage if used."
err=f"There is no model file or params file in this directory: {inference_model_dir}"
raiseInputModelError(err)
return
else:
err=f"Please specify the model name supported by PaddleClas or directory contained model file and params file."
raiseInputModelError(err)
return
defpredict(self,input_data,print_pred=True):
"""Predict label of img with paddleclas.
Args:
Args:
input_data(string, NumPy.ndarray): image to be classified, support:
input_data(str, NumPy.ndarray):
string: local path of image file, internet URL, directory containing series of images;
image to be classified, support: str(local path of image file, internet URL, directory containing series of images) and NumPy.ndarray(preprocessed image data that has 3 channels and accords with [C, H, W], or raw image data that has 3 channels and accords with [H, W, C]).
NumPy.ndarray: preprocessed image data that has 3 channels and accords with [C, H, W], or raw image data that has 3 channels and accords with [H, W, C]
Returns:
Returns:
dict: {image_name: "", class_id: [], scores: [], label_names: []},if label name path == None,label_names will be empty.
dict: {image_name: "", class_id: [], scores: [], label_names: []},if label name path == None,label_names will be empty.