Prediction¶
sahi.prediction
¶
Classes¶
ObjectPrediction
¶
Bases: ObjectAnnotation
Class for handling detection model predictions.
Source code in sahi/prediction.py
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
Functions¶
__init__(bbox=None, category_id=None, category_name=None, segmentation=None, score=0.0, shift_amount=[0, 0], full_shape=None)
¶
Creates ObjectPrediction from bbox, score, category_id, category_name, segmentation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bbox
¶ |
Optional[List[int]]
|
list [minx, miny, maxx, maxy] |
None
|
score
¶ |
float
|
float Prediction score between 0 and 1 |
0.0
|
category_id
¶ |
Optional[int]
|
int ID of the object category |
None
|
category_name
¶ |
Optional[str]
|
str Name of the object category |
None
|
segmentation
¶ |
Optional[List[List[float]]]
|
List[List] [ [x1, y1, x2, y2, x3, y3, ...], [x1, y1, x2, y2, x3, y3, ...], ... ] |
None
|
shift_amount
¶ |
Optional[List[int]]
|
list To shift the box and mask predictions from sliced image to full sized image, should be in the form of [shift_x, shift_y] |
[0, 0]
|
full_shape
¶ |
Optional[List[int]]
|
list Size of the full image after shifting, should be in the form of [height, width] |
None
|
Source code in sahi/prediction.py
get_shifted_object_prediction()
¶
Returns shifted version ObjectPrediction. Shifts bbox and mask coords. Used for mapping sliced predictions over full image.
Source code in sahi/prediction.py
to_coco_prediction(image_id=None)
¶
Returns sahi.utils.coco.CocoPrediction representation of ObjectAnnotation.
Source code in sahi/prediction.py
to_fiftyone_detection(image_height, image_width)
¶
Returns fiftyone.Detection representation of ObjectPrediction.
Source code in sahi/prediction.py
PredictionResult
¶
Source code in sahi/prediction.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
Functions¶
export_visuals(export_dir, text_size=None, rect_th=None, hide_labels=False, hide_conf=False, file_name='prediction_visual')
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_dir
¶ |
str
|
directory for resulting visualization to be exported |
required |
text_size
¶ |
Optional[float]
|
size of the category name over box |
None
|
rect_th
¶ |
Optional[int]
|
rectangle thickness |
None
|
hide_labels
¶ |
bool
|
hide labels |
False
|
hide_conf
¶ |
bool
|
hide confidence |
False
|
file_name
¶ |
str
|
saving name |
'prediction_visual'
|
Returns: