Classification Prediction Check
This file provides the capability to manually specify files to be evaluated by a model in order to manually check the outputs.
This file is not to be used for extensive testing, but a quick method to ensure the model and prediction are working as expected, and to test the predictions of difficult images.
Attributes:
Name | Type | Description |
---|---|---|
img_size |
int
|
The specified image size as input to the EfficientNet-B6 model (528). |
img_path |
str
|
The path to the image to be predicted using the CNN model. Please note the image should be in |
model_path |
str
|
The path to the model to be used to evaluate the image. |
load_paths(model_name, image_path)
This method creates the correct paths to load the CNN model and access the image to be predicted
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name |
str
|
The name of the model to be loaded in order to predict the image. Example: |
required |
image_path |
str
|
The path to the image to be predicted. This originates from the |
required |
Source code in src/models/image/manual_test.py
25 26 27 28 29 30 31 32 33 34 |
|
predict(model_name, image_path)
This method provides a simplified prediction process, where the model name and image path are required, and it will print the models prediction for viewing.
In the provided example, the family taxon_train classification model is used to test if Elephantidae is predicted over Felidae. Due to the alphabetical ordering that Elephantidae comes before Felidae, we know it should be the first value will represent the Elephantidae class. Use the taxon_train directory to determine which class is predicted. This is a rough and quick method to confirm the model is working correctly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name |
str
|
The name of the model to be loaded in order to predict the image. Example: |
required |
image_path |
str
|
The path to the image to be predicted. This originates from the |
required |
Source code in src/models/image/manual_test.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|