12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System.Collections.Generic;
- using AI.Common;
- using AI.Common.InferenceNetworks;
- using Microsoft.ML.OnnxRuntime;
- namespace AutoBlineCalculationLib
- {
- public class InferNetOnnxAutoBlineSeg : InferNetOnnxSemanticSegBasic
- {
- #region override
- /// <summary>
- /// 哈希值
- /// </summary>
- public override string HashCode => "e4cb7203d35e5a42fc313ba37ea112ab";
- /// <summary>
- /// 网络名
- /// </summary>
- public override string NetworkName => "BlineSegment.emd";
- /// <summary>
- /// 复制
- /// </summary>
- /// <param name="cloneMethod"></param>
- /// <returns></returns>
- public override IInferenceNetwork Clone(EnumCloneMethod cloneMethod)
- {
- if (!_modelLoaded)
- {
- return new InferNetOnnxAutoBlineSeg();
- }
- return new InferNetOnnxAutoBlineSeg(_trainedModel, _sessionOption);
- }
- #endregion
- #region constructor
- public InferNetOnnxAutoBlineSeg()
- {
- ModelParamsAssign();
- ConstructIntermediateVariables();
- }
- public InferNetOnnxAutoBlineSeg(byte[] trainedModel, SessionOptions sessionOption)
- {
- ModelParamsAssign();
- ConstructIntermediateVariables();
- ConstructClonedModelRelatedVariables(trainedModel, sessionOption);
- }
- #endregion
- #region private
- private void ModelParamsAssign()
- {
- _inputVariableName = "input.1";
- _inputAxisOrder = EnumAxisOrder.CHW;
- _modelInputH = 256;
- _modelInputW = 256;
- _modelInputC = 3;
- _outputVariableName = "575";
- _outputAxisOrder = EnumAxisOrder.CHW;
- _modelOutputC = 5;
- _modelOutputH = 256;
- _modelOutputW = 256;
- _resizeMode = EnumResizeMode.Warp;
- _meanValueType = EnumMeanValueType.None;
- _scaleType = EnumScaleValueType.ConstantScale;
- _scaleR = 1.0f;
- _scaleG = 1.0f;
- _scaleB = 1.0f;
- _normType = EnumNormalizationType.None;
- _reverseInputChannels = true;
- _segPostProcessParam = new Dictionary<int, SemanticSegmentationPostProcessParams>
- {
- // 1为胸膜线;2为B线;3为A线;4为肺实变
- { 1, new SemanticSegmentationPostProcessParams( new List<LesionAreaSelectInfo>(){new LesionAreaSelectInfo(EnumLesionAreaThresholdType.PixelInMask, 20, -1)}, 20)},
- { 2, new SemanticSegmentationPostProcessParams( new List<LesionAreaSelectInfo>(){new LesionAreaSelectInfo(EnumLesionAreaThresholdType.PixelInMask, 20, -1)}, 20)},
- { 3, new SemanticSegmentationPostProcessParams( new List<LesionAreaSelectInfo>(){new LesionAreaSelectInfo(EnumLesionAreaThresholdType.PixelInMask, 20, -1)}, 20)},
- { 4, new SemanticSegmentationPostProcessParams( new List<LesionAreaSelectInfo>(){new LesionAreaSelectInfo(EnumLesionAreaThresholdType.PixelInMask, 20, -1)}, 20)},
- };
- }
- #endregion
- }
- }
|