using System; using System.Text.Json.Serialization; using Vinno.AI.CommonSDK.Enums; using Vinno.AI.CommonSDK.Interfaces; namespace Vinno.AI.CarotidClassificationSDK.Models { public class CarotidClassificationParameter : IAIParameter { /// /// 用于CarotidClassification计算的CPU数 /// public int CPUNumber { get; } /// /// 检测模式 /// public AIEnumDetectMode DetectMode { get; set; } /// /// 当检测模式为EnumDetectMode.TimesPerSecond时,指每秒的图片吞吐量,DetectTps必须大于0 /// public int DetectTps { get; set; } /// /// 当检测模式为当检测模式为EnumDetectMode.PeriodicIntervals时,指检测的间隔时间,当间隔时间<0时,则启动内置的时间间隔。 /// public int IntervalTime { get; set; } /// /// 结果是否包含轮廓信息 /// public bool IsIncludeContour { get; } public CarotidClassificationParameter(int cpuNumber, bool isIncludeContour) { CPUNumber = cpuNumber; IsIncludeContour = isIncludeContour; DetectMode = AIEnumDetectMode.TimesPerSecond; DetectTps = 2; IntervalTime = 200; } [JsonConstructor] public CarotidClassificationParameter(int cpuNumber, AIEnumDetectMode detectMode, int detectTps, int intervalTime, bool isIncludeContour) { if (detectTps <= 0) { throw new ArgumentOutOfRangeException($"Detect Tps must >0,Detect Tps is {detectTps}"); } if (intervalTime < 0) { throw new ArgumentOutOfRangeException($"interval Time must >=0,Interval Time is {intervalTime}"); } CPUNumber = cpuNumber; DetectMode = detectMode; DetectTps = detectTps; IntervalTime = intervalTime; IsIncludeContour = isIncludeContour; } } }