移除cv,请使用@yizhi/cv包
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { cv } from "../../cv";
|
||||
import cv from "@yizhi/cv";
|
||||
import { ImageCropOption, ImageSource, Model } from "../common/model";
|
||||
import { convertImage } from "../common/processors";
|
||||
|
||||
@ -25,8 +25,8 @@ export class GenderAge extends Model {
|
||||
private async doPredict(image: cv.Mat, option?: GenderAgePredictOption): Promise<GenderAgePredictResult> {
|
||||
const input = this.input;
|
||||
const output = this.output;
|
||||
if (option?.crop) image = image.crop(option.crop.sx, option.crop.sy, option.crop.sw, option.crop.sh);
|
||||
image = image.resize(input.shape[3], input.shape[2]);
|
||||
if (option?.crop) image = cv.crop(image, option.crop);
|
||||
image = cv.resize(image, input.shape[3], input.shape[2]);
|
||||
|
||||
const nchwImage = convertImage(image.data, { sourceImageFormat: "bgr", targetColorFormat: "rgb", targetShapeFormat: "nchw", targetNormalize: { mean: [0], std: [1] } });
|
||||
|
||||
|
Reference in New Issue
Block a user