efficientnet
mindnlp.transformers.models.efficientnet.image_processing_efficientnet
¶
Image processor class for EfficientNet.
mindnlp.transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor
¶
Bases: BaseImageProcessor
Constructs a EfficientNet image processor.
PARAMETER | DESCRIPTION |
---|---|
do_resize |
Whether to resize the image's (height, width) dimensions to the specified
TYPE:
|
size |
346, "width": 346}
TYPE:
|
resample |
Resampling filter to use if resizing the image. Can be overridden by
TYPE:
|
do_center_crop |
Whether to center crop the image. If the input size is smaller than
TYPE:
|
crop_size |
289, "width": 289}
TYPE:
|
rescale_factor |
Scale factor to use if rescaling the image. Can be overridden by the
TYPE:
|
rescale_offset |
Whether to rescale the image between [-scale_range, scale_range] instead of [0, scale_range]. Can be
overridden by the
TYPE:
|
do_rescale |
Whether to rescale the image by the specified scale
TYPE:
|
do_normalize |
Whether to normalize the image. Can be overridden by the
TYPE:
|
image_mean |
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the
TYPE:
|
image_std |
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the
TYPE:
|
include_top |
Whether to rescale the image again. Should be set to True if the inputs are used for image classification.
TYPE:
|
Source code in mindnlp/transformers/models/efficientnet/image_processing_efficientnet.py
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 164 165 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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
mindnlp.transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor.__init__(do_resize=True, size=None, resample=PIL.Image.NEAREST, do_center_crop=False, crop_size=None, rescale_factor=1 / 255, rescale_offset=False, do_rescale=True, do_normalize=True, image_mean=None, image_std=None, include_top=True, **kwargs)
¶
Initializes an instance of the EfficientNetImageProcessor class.
PARAMETER | DESCRIPTION |
---|---|
do_resize |
Whether to resize the image. Defaults to True.
TYPE:
|
size |
The target size for resizing the image. Defaults to None.
TYPE:
|
resample |
The resampling filter to use when resizing the image. Defaults to PIL.Image.NEAREST.
TYPE:
|
do_center_crop |
Whether to perform a center crop on the image. Defaults to False.
TYPE:
|
crop_size |
The size of the center crop. Defaults to None.
TYPE:
|
rescale_factor |
The factor by which to rescale the image pixel values. Defaults to 1 / 255.
TYPE:
|
rescale_offset |
Whether to offset the rescaled image pixel values. Defaults to False.
TYPE:
|
do_rescale |
Whether to rescale the image pixel values. Defaults to True.
TYPE:
|
do_normalize |
Whether to normalize the image pixel values. Defaults to True.
TYPE:
|
image_mean |
The mean pixel values used for normalization. Defaults to None.
TYPE:
|
image_std |
The standard deviation of pixel values used for normalization. Defaults to None.
TYPE:
|
include_top |
Whether to include the top layers of the EfficientNet model. Defaults to True.
TYPE:
|
**kwargs |
Additional keyword arguments.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
Source code in mindnlp/transformers/models/efficientnet/image_processing_efficientnet.py
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 164 165 166 |
|
mindnlp.transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor.preprocess(images, do_resize=None, size=None, resample=None, do_center_crop=None, crop_size=None, do_rescale=None, rescale_factor=None, rescale_offset=None, do_normalize=None, image_mean=None, image_std=None, include_top=None, return_tensors=None, data_format=ChannelDimension.FIRST, input_data_format=None, **kwargs)
¶
Preprocess an image or batch of images.
PARAMETER | DESCRIPTION |
---|---|
images |
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set
TYPE:
|
do_resize |
Whether to resize the image.
TYPE:
|
size |
Size of the image after
TYPE:
|
resample |
PILImageResampling filter to use if resizing the image Only has an effect if
TYPE:
|
do_center_crop |
Whether to center crop the image.
TYPE:
|
crop_size |
Size of the image after center crop. If one edge the image is smaller than
TYPE:
|
do_rescale |
Whether to rescale the image values between [0 - 1].
TYPE:
|
rescale_factor |
Rescale factor to rescale the image by if
TYPE:
|
rescale_offset |
Whether to rescale the image between [-scale_range, scale_range] instead of [0, scale_range].
TYPE:
|
do_normalize |
Whether to normalize the image.
TYPE:
|
image_mean |
Image mean.
TYPE:
|
image_std |
Image standard deviation.
TYPE:
|
include_top |
Rescales the image again for image classification if set to True.
TYPE:
|
return_tensors |
The type of tensors to return. Can be one of:
TYPE:
|
data_format |
The channel dimension format for the output image. Can be one of:
TYPE:
|
input_data_format |
The channel dimension format for the input image. If unset, the channel dimension format is inferred from the input image. Can be one of:
TYPE:
|
Source code in mindnlp/transformers/models/efficientnet/image_processing_efficientnet.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
mindnlp.transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor.rescale(image, scale, offset=True, data_format=None, input_data_format=None, **kwargs)
¶
Rescale an image by a scale factor.
If offset
is True
, the image has its values rescaled by scale
and then offset by 1. If scale
is
1/127.5, the image is rescaled between [-1, 1].
image = image * scale - 1
If offset
is False
, and scale
is 1/255, the image is rescaled between [0, 1].
image = image * scale
PARAMETER | DESCRIPTION |
---|---|
image |
Image to rescale.
TYPE:
|
scale |
Scale to apply to the image.
TYPE:
|
offset |
Whether to scale the image in both negative and positive directions.
TYPE:
|
data_format |
The channel dimension format of the image. If not provided, it will be the same as the input image.
TYPE:
|
input_data_format |
The channel dimension format of the input image. If not provided, it will be inferred.
TYPE:
|
Source code in mindnlp/transformers/models/efficientnet/image_processing_efficientnet.py
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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
|
mindnlp.transformers.models.efficientnet.image_processing_efficientnet.EfficientNetImageProcessor.resize(image, size, resample=PILImageResampling.NEAREST, data_format=None, input_data_format=None, **kwargs)
¶
Resize an image to (size["height"], size["width"])
.
PARAMETER | DESCRIPTION |
---|---|
image |
Image to resize.
TYPE:
|
size |
Dictionary in the format
TYPE:
|
resample |
TYPE:
|
data_format |
The channel dimension format for the output image. If unset, the channel dimension format of the input image is used. Can be one of:
TYPE:
|
input_data_format |
The channel dimension format for the input image. If unset, the channel dimension format is inferred from the input image. Can be one of:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ndarray
|
|
Source code in mindnlp/transformers/models/efficientnet/image_processing_efficientnet.py
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 |
|