1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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
- {
- /// <summary>
- /// 用于CarotidClassification计算的CPU数
- /// </summary>
- public int CPUNumber { get; }
- /// <summary>
- /// 检测模式
- /// </summary>
- public AIEnumDetectMode DetectMode { get; set; }
- /// <summary>
- /// 当检测模式为EnumDetectMode.TimesPerSecond时,指每秒的图片吞吐量,DetectTps必须大于0
- /// </summary>
- public int DetectTps { get; set; }
- /// <summary>
- /// 当检测模式为当检测模式为EnumDetectMode.PeriodicIntervals时,指检测的间隔时间,当间隔时间<0时,则启动内置的时间间隔。
- /// </summary>
- public int IntervalTime { get; set; }
- /// <summary>
- /// 结果是否包含轮廓信息
- /// </summary>
- 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;
- }
- }
- }
|