(input: ImageInput, options: ImageClassificationOptions)
| 55 | } |
| 56 | |
| 57 | private preprocess(input: ImageInput, options: ImageClassificationOptions) { |
| 58 | // Preprocessing involves center crop and normalizing between [-1, 1]. |
| 59 | const img = imageToTensor(input); |
| 60 | const croppedImg = options.centerCrop ? |
| 61 | centerCropAndResize(img) : |
| 62 | expandDims(image.resizeBilinear(img, IMG_SIZE)); |
| 63 | return sub(div(croppedImg, DIV_FACTOR), SUB_FACTOR); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | export async function loadImageClassification(modelUrl: string): |
no test coverage detected