Amazon¶
AI4GAmazonRainforest
¶
Bases: PlainResNetInference
Amazon Ranforest Animal Classifier that inherits from PlainResNetInference. This classifier is specialized for recognizing 36 different animals in the Amazon Rainforest.
Source code in PytorchWildlife/models/classification/resnet_base/amazon.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
__init__(weights=None, device='cpu', pretrained=True, version='v2')
¶
Initialize the Amazon animal Classifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weights
|
str
|
Path to the model weights. Defaults to None. |
None
|
device
|
str
|
Device for model inference. Defaults to "cpu". |
'cpu'
|
pretrained
|
bool
|
Whether to use pretrained weights. Defaults to True. |
True
|
version
|
str
|
Version of the model to load. Default is 'v2'. |
'v2'
|
Source code in PytorchWildlife/models/classification/resnet_base/amazon.py
results_generation(logits, img_ids, id_strip=None)
¶
Generate results for classification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logits
|
Tensor
|
Output tensor from the model. |
required |
img_ids
|
str
|
Image identifier. |
required |
id_strip
|
str
|
stiping string for better image id saving. |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
list[dict]
|
Dictionary containing image ID, prediction, and confidence score. |