phenocam_snow.predict
- classify_online(model, categories, img_url)
Performs online classification.
- Parameters:
model (PhenoCamResNet) – The model to use.
categories (List[str]) – The categories to use.
img_url (str) – The URL of the image to run classification on.
- Returns:
A 2-tuple where the first element is the image at img_url as a NumPy array and the second element is the predicted label.
- classify_offline(model, categories, img_path)
Performs offline classification.
- Parameters:
model (PhenoCamResNet) – The model to use.
categories (List[str]) – The image categories.
img_path (str) – The file path of the image to classify.
- Returns:
A 2-tuple where the first element is the image at img_path as a NumPy array and the second element is the predicted label.
- load_model_from_file(model_path, resnet, n_classes)
Loads a model from checkpoint file.
- Parameters:
- Returns:
The loaded model.
- Return type:
- run_model_offline(model, site_name, categories, img_dir)
Gets predicted labels for all images in a directory.
- Parameters:
model (PhenoCamResNet) – The model to use.
site_name (str) – The name of the PhenoCam site.
img_dir (str) – The directory containing the images to classify.
- Returns:
A pandas DataFrame with predictions.
- Return type:
pd.DataFrame
- run_model_online(model, site_name, categories, urls)
Gets predicted label for image online.
- Parameters:
model (PhenoCamResNet) – The model to use.
site_name (str) – The name of the PhenoCam site.
url (str) – The URL of the image for which you want a prediction, or the name of a file containing all the URLs, one per line.