1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Text.Json.Serialization;
- using Vinno.AI.CommonSDK.Enums;
- using Vinno.AI.CommonSDK.Interfaces;
- namespace Vinno.AI.OrganIdentificationSDK.Models
- {
- public class OrganIdentificationParameter : IAIParameter
- {
- /// <summary>
- /// 性能配置
- /// </summary>
- public AIEnumPerformance Performance { get; }
- /// <summary>
- /// 检测模式
- /// </summary>
- public AIEnumDetectMode DetectMode { get; set; }
- /// <summary>
- /// 图像是否被裁剪
- /// </summary>
- public bool IsCropped { get; set; }
- /// <summary>
- /// 当检测模式为EnumDetectMode.TimesPerSecond时,指每秒的图片吞吐量,DetectTps必须大于0
- /// </summary>
- public int DetectTps { get; set; }
- /// <summary>
- /// 当检测模式为当检测模式为EnumDetectMode.PeriodicIntervals时,指检测的间隔时间.必须大于等于0
- /// </summary>
- public int IntervalTime { get; set; }
- public OrganIdentificationParameter(AIEnumPerformance performance, bool isCropped)
- {
- Performance = performance;
- IsCropped = isCropped;
- DetectMode = AIEnumDetectMode.TimesPerSecond;
- DetectTps = 2;
- IntervalTime = 200;
- }
- [JsonConstructor]
- public OrganIdentificationParameter(AIEnumPerformance performance = AIEnumPerformance.Low, AIEnumDetectMode detectMode = AIEnumDetectMode.TimesPerSecond, bool isCropped = false, int detectTps = 2, int intervalTime = 350)
- {
- 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}");
- }
- Performance = performance;
- DetectMode = detectMode;
- IsCropped = isCropped;
- DetectTps = detectTps;
- IntervalTime = intervalTime;
- }
- }
- }
|