clip static method

TensorPipeline clip({
  1. int size = 224,
  2. InterpolationMode interpolation = InterpolationMode.bicubic,
})

Creates a pipeline for CLIP vision encoder.

Implementation

static TensorPipeline clip({
  int size = 224,
  InterpolationMode interpolation = InterpolationMode.bicubic,
}) {
  return TensorPipeline([
    ResizeShortestOp(shortestEdge: size, mode: interpolation),
    CenterCropOp(height: size, width: size),
    ToTensorOp(normalize: true),
    NormalizeOp(
      mean: [0.48145466, 0.4578275, 0.40821073],
      std: [0.26862954, 0.26130258, 0.27577711],
    ),
    UnsqueezeOp.batch(),
  ], name: 'CLIP');
}