AI 공통 설정

1 개요

2 필수 옵션

2.1 Image 설정

2.1.1 개요

  1. 딥러닝에 사용할 이미지를 설정합니다.
    1. Validation Image 미 설정 시 Validation 없이 동작합니다.
    2. Inference Result 이미지를 설정하여야 해당 이미지에서 추론 결과를 얻을 수 있습니다.

2.1.2 API

  1. Learn Image 설정
    • SetLearningImage(const Base::CFLImage&)
    • SetLearningImage(const Base::CFLImage*)
  2. Validation Image 설정
    • SetLearningValidationImage(const Base::CFLImage&)
    • SetLearningValidationImage(const Base::CFLImage*)
  3. Inference Image 설정
    • SetInferenceImage(const Base::CFLImage&)
    • SetInferenceImage(const Base::CFLImage*)
  4. Inference Result Image 설정
    • SetInferenceResultImage(Base::CFLImage&)
    • SetInferenceResultImage(Base::CFLImage*)

2.1.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;
CFLImage fliLearnImage;
CFLImage fliValidationImage;
CFLImage fliInferenceImage;
CFLImage fliInferenceResultImage;

fliLearnImage.Load(L"Learn.flif");
fliValidationImage.Load(L"Validation.flif");
fliInferenceImage.Load(L"Inference.flif");

// fliInferenceResultImage 는 결과를 받아오는 이미지 객체
semanticSegmentationDL.SetLearningImage(fliLearnImage);
semanticSegmentationDL.SetLearningValidationImage(fliValidationImage);
semanticSegmentationDL.SetInferenceImage(fliInferenceImage);
semanticSegmentationDL.SetInferenceResultImage(fliInferenceResultImage);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();
CFLImage fliLearnImage = new CFLImage();
CFLImage fliValidationImage = new CFLImage();
CFLImage fliInferenceImage = new CFLImage();
CFLImage fliInferenceResultImage = new CFLImage();

fliLearnImage.Load("Learn.flif");
fliValidationImage.Load("Validation.flif");
fliInferenceImage.Load("Inference.flif");

// fliInferenceResultImage 는 결과를 받아오는 이미지 객체
semanticSegmentationDL.SetLearningImage(ref fliLearnImage);
semanticSegmentationDL.SetLearningValidationImage(ref fliValidationImage);
semanticSegmentationDL.SetInferenceImage(ref fliInferenceImage);
semanticSegmentationDL.SetInferenceResultImage(ref fliInferenceResultImage);
semanticSegmentationDL = CSemanticSegmentationDL()
fliLearnImage = CFLImage()
fliValidationImage = CFLImage()
fliInferenceImage = CFLImage()
fliInferenceResultImage = CFLImage()

fliLearnImage.Load("Learn.flif")
fliValidationImage.Load("Validation.flif")
fliInferenceImage.Load("Inference.flif")

# fliInferenceResultImage 는 결과를 받아오는 이미지 객체
semanticSegmentationDL.SetLearningImage(fliLearnImage)
semanticSegmentationDL.SetLearningValidationImage(fliValidationImage)
semanticSegmentationDL.SetInferenceImage(fliInferenceImage)
semanticSegmentationDL.SetInferenceResultImage(fliInferenceResultImage)

2.1.4 GUI에서 설정 방법

  1. 학습/검증/추론할 이미지를 Image View에 로드합니다.
Load image

Fig. Dialog 창에서 출력되는 학습 결과 정보


  1. 각 동작에 사용할 이미지가 있는 뷰를 선택합니다. 또는 학습/검증 이미지는 Load Image With Path 옵션으로 해당 이미지가 있는 경로를 지정하여 설정할 수 있습니다.
Select view

Fig. Dialog 창에서 출력되는 학습 결과 정보

2.2 Optimizer 설정

2.2.1 개요

  1. 학습에 사용할 Optimizer를 선택합니다.
    1. 다양한 Optimizer를 지원하며, 기본값은 Adam Optimizer를 사용합니다.
    2. 별도의 설정을 하지 않더라도 기본값으로 사용 가능합니다.
  2. OptimizerSpec 클래스를 통해 파라미터를 설정합니다.
    1. Learning Rate 및 Optimizer 종류에 따라 Beta 값 등을 설정합니다.
    2. Spec 클래스는 Optimizer의 종류마다 개별적으로 구현되어 있습니다.
      1. Gradient Descent
      2. Stochastic Gradient Descent
      3. Ada Gradient Descent
      4. Momentum Gradient Descent
      5. RMS Prop Gradient Descent
      6. Adam Gradient Descent
      7. Ada Belief Gradient Descent
  3. Gradient Clipping 적용 여부를 선택합니다.
    1. 모델에 따라 학습을 진행하면 미분값이 매우 커지거나, 작아지는 가능성이 존재합니다.
    2. Gradient clipping은 이러한 현상을 방지하기 위해 gradient가 일정 threshold를 넘어가면 gradient의 크기를 재조정합니다.

2.2.2 API

2.2.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

// 일반적으로 설정할 필요 없음
COptimizerSpecAdamGradientDescent optSpec;

optSpec.SetLearningRate(1e-3f);
optSpec.SetBeta1(0.99f);
optSpec.EnableAutoSubdivision(false);
semanticSegmentationDL.EnableLearningGradientClipping(true);
semanticSegmentationDL.SetLearningGradientClippingThreshold(20.f);
semanticSegmentationDL.SetLearningOptimizerSpec(optSpec);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

// 일반적으로 설정할 필요 없음
COptimizerSpecAdamGradientDescent optSpec = new COptimizerSpecAdamGradientDescent();

optSpec.SetLearningRate(1e-3f);
optSpec.SetBeta1(0.99f);
optSpec.EnableAutoSubdivision(false);
semanticSegmentationDL.EnableLearningGradientClipping(true);
semanticSegmentationDL.SetLearningGradientClippingThreshold(20.0f);
semanticSegmentationDL.SetLearningOptimizerSpec(optSpec);
semanticSegmentationDL = CSemanticSegmentationDL()

# 일반적으로 설정할 필요 없음
optSpec = COptimizerSpecAdamGradientDescent()

optSpec.SetLearningRate(1e-3)
optSpec.SetBeta1(0.99)
optSpec.EnableAutoSubdivision(False)
semanticSegmentationDL.EnableLearningGradientClipping(True)
semanticSegmentationDL.SetLearningGradientClippingThreshold(20.0)
semanticSegmentationDL.SetLearningOptimizerSpec(optSpec)

2.2.4 GUI에서 설정 방법

Select Optimizer

Fig. Optimizer 종류 선택

Optimizer parameter setting

Fig. Optimizer 관련 세부 parameter 설정

2.3 Learning 정보 설정

2.3.1 Learning Epoch 설정

2.3.1.1 개요

2.3.1.2 API

2.3.1.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.SetLearningEpoch(10000);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.SetLearningEpoch(10000);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.SetLearningEpoch(10000)

2.3.1.4 GUI에서 설정 방법

Epoch setting

Fig. Epoch 설정

2.3.2 Validation Step 설정

2.3.2.1 개요

  1. 학습 중 특정 Epoch 마다 Validation을 진행하도록 설정합니다.
    1. 기본값은 1이며, 매 Epoch 마다 Validation합니다.
    2. 0인 경우 Validation을 하지 않습니다.
    3. 1보다 큰 경우 설정한 Epoch 단위 마다 Validation을 진행하며, 마지막 Epoch에는 항상 Validation 합니다.

2.3.2.2 API

2.3.2.3 예제 코드

CFLImage fliValidationImage;
CSemanticSegmentationDL semanticSegmentationDL;

fliValidationImage.Load(L"Validation.flif");
semanticSegmentationDL.SetLearningValidationImage(fliValidationImage);
semanticSegmentationDL.SetLearningValidationStep(3);
CFLImage fliValidationImage = new CFLImage();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

fliValidationImage.Load("Validation.flif");
semanticSegmentationDL.SetLearningValidationImage(ref fliValidationImage);
semanticSegmentationDL.SetLearningValidationStep(3);
fliValidationImage = CFLImage()
semanticSegmentationDL = CSemanticSegmentationDL()

fliValidationImage.Load("Validation.flif")
semanticSegmentationDL.SetLearningValidationImage(fliValidationImage)
semanticSegmentationDL.SetLearningValidationStep(3)

2.3.2.4 GUI에서 설정 방법

Validation Step setting

Fig. Validation Step 설정

2.4 Augmentation 설정

2.4.1 개요

2.4.2 API

  1. Common Parameter 관련
    • EnableAugmentation(bool) : true가 기본값이며, false로 설정 시 모든 옵션 비활성화됩니다.
    • SetCommonActivationRate(double) : 설정한 비율만큼 Augmentation 동작을 활성화합니다.
    • SetCommonIoUThreshold(double) : Rotation, CutMix와 같이 Label Figure의 넓이가 연산 후 너무 많이 제거된 경우 설정한 Threshold 비율로 제거합니다. Augmentation IoU Threshold는 Augmentation으로 인해 라벨링된 부분이 짤릴 경우 라벨링을 보존 여부를 정하는 임곗 값입니다. 0.0 ~ 1.0의 범위를 가지며 0.8을 설정할 경우 원래의 영역의 80%가 넘게 남아있지 않은 경우 라벨을 제거합니다.
    • SetCommonInterpolationMethod(ImageProcessing::EInterpolationMethod) : Rotation, Scale, Perspective과 같은 Augmentation 기법에서 사용할 Interpolation 방법을 설정합니다.
  2. 각각의 Augmentation 방식 관련
    1. Mix Method
      • EnableMixMethod(bool)
      • SetMixMethodParam(EMixMethod eMixMethod = EMixMethod_None, double f64MixActivationRate = 1.)
        • eMixMethod : 사용할 Mix 방식
        • f64MixActivationRate : 전체 데이터에 대해 Mix 방식을 적용하는 데이터의 비율
      1. MixUp
        • SetMixUpParam(double f64MinMixUpBlendRatio = 4., double f64MaxMixUpBlendRatio = .6)
          • f64MinMixUpBlendRatio : MixUp 최소 Blend 비율
          • f64MaxMixUpBlendRatio : MixUp 최대 Blend 비율
      2. Mosaic
        • 별도의 Parameter 설정이 없음
      3. CutMix
        • SetCutMixParam(double f64MinCutMixRatioX = 0.1, double f64MaxCutMixRatioX = .4, double f64MinCutMixRatioY = 0.1, double f64MaxCutMixRatioY = .4, double f64MinCutMixBlendRatio = 0., double f64MaxCutMixBlendRatio = .0)
          • f64MinCutMixRatioX : X방향으로의 CutMix 최소 비율
          • f64MaxCutMixRatioX : X방향으로의 CutMix 최대 비율
          • f64MinCutMixRatioY : Y방향으로의 CutMix 최소 비율
          • f64MaxCutMixRatioY : Y방향으로의 CutMix 최대 비율
          • f64MinCutMixBlendRatio : CutMix 최소 Blend 비율
          • f64MaxCutMixBlendRatio : CutMix 최대 Blend 비율
      4. ObjectMix
        • SetObjectMixParam(double f64MinTranslationRatioX = -0.1, double f64MaxTranslationRatioX = 0.1, double f64MinTranslationRatioY = -0.1, double f64MaxTranslationRatioY = 0.1, double f64MinObjectMixScaleRatioX = 00.8, double f64MaxObjectMixScaleRatioX = 1.25, double f64MinObjectMixScaleRatioY = 00.8, double f64MaxObjectMixScaleRatioY = 1.25, bool bObjectMixPreservingScaleRatio = true, double f64MinObjectMixRotation = -5., double f64MaxObjectMixRotation = .5, bool bObjectMixHorizontalFlip = false, bool bObjectMixVerticalFlip = false, int64_t i64MinObjectMixCount = 1, int64_t i64MaxObjectMixCount = 2)
          • f64MinTranslationRatioX : X방향으로의 ObjectMix 최소 옮기는 비율
          • f64MaxTranslationRatioX : X방향으로의 ObjectMix 최대 옮기는 비율
          • f64MinTranslationRatioY : Y방향으로의 ObjectMix 최소 옮기는 비율
          • f64MaxTranslationRatioY : Y방향으로의 ObjectMix 최대 옮기는 비율
          • f64MinObjectMixScaleRatioX : X방향으로의 ObjectMix 최소 확장 비율
          • f64MaxObjectMixScaleRatioX : X방향으로의 ObjectMix 최대 확장 비율
          • f64MinObjectMixScaleRatioY : Y방향으로의 ObjectMix 최소 확장 비율
          • f64MaxObjectMixScaleRatioY : Y방향으로의 ObjectMix 최대 확장 비율
          • bObjectMixPreservingScaleRatio : ObjectMix 최대 확장 비율
          • f64MinObjectMixRotation : ObjectMix 최소 회전 비율
          • f64MaxObjectMixRotation : ObjectMix 최대 회전 비율
          • bObjectMixHorizontalFlip : ObjectMix 좌우 반전
          • bObjectMixVerticalFlip : ObjectMix 상하 반전
          • i64MinObjectMixCount : ObjectMix 최소 개수
          • i64MaxObjectMixCount : ObjectMix 최대 개수수
    2. Resized Crop
      • EnableResizedCrop(bool)
      • SetResizedCropParam(double f64MinResizedCropScaleRatio = .8, double f64MaxResizedCropScaleRatio = 1.0, double f64MinResizedCropAspectRatio = 0.8, double f64MaxResizedCropAspectRatio = 1.25, double f64ResizedCropActivationRate = 1.)
        • f64MinResizedCropScaleRatio : Resized 되기 전 Crop 되어질 영역의 면적의 스케일 최소 비율
        • f64MaxResizedCropScaleRatio : Resized 되기 전 Crop 되어질 영역의 면적의 스케일 최대 비율
        • f64MinResizedCropAspectRatio : Resized 되기 전 Crop 되어질 영역의 최소 종횡비 비율
        • f64MaxResizedCropAspectRatio : Resized 되기 전 Crop 되어질 영역의 최대 종횡비 비율
        • f64ResizedCropActivationRate : Batch 마다 적용되는 ResizedCrop 활성화 비율
    3. Horizontal Flip
      • EnableHorizontalFlip(bool)
      • SetHorizontalFlipParam(double f64HorizontalFlipActivationRate = 1.)
        • f64HorizontalFlipActivationRate : Batch 마다 적용되는 수평 반전 활성화 비율
    4. Vertical Flip
      • EnableVerticalFlip(bool)
      • SetVerticalFlipParam(double f64VerticalFlipActivationRate = 1.)
        • f64VerticalFlipActivationRate : Batch 마다 적용되는 수직 반전 활성화 비율
    5. Adjustment
      • EnableAdjustment(bool)
      • SetAdjustmentParam(double f64MinAdjustmentBrightness = 0.8, double f64MaxAdjustmentBrightness = 1.25, double f64MinAdjustmentContrast = 0.8, double f64MaxAdjustmentContrast = 1.25, double f64AdjustmentActivationRate = 1.)
        • f64MinAdjustmentBrightness : 최소 밝기
        • f64MaxAdjustmentBrightness : 최대 밝기
        • f64MinAdjustmentContrast : 최소 대비
        • f64MaxAdjustmentContrast : 최대 대비
        • f64AdjustmentActivationRate : Batch 마다 적용되는 Adjustment 활성화 비율
    6. Intensity
      • EnableIntensity(bool)
      • SetIntensityParam(double f64MinSaturation = 0.8, double f64MaxSaturation = 1.25, double f64MinExposure = 0.8, double f64MaxExposure = 1.25, double f64MinHue = -.03, double f64MaxHue = .03, double f64IntensityActivationRate = 1.)
        • f64MinSaturation : S 최소 값
        • f64MaxSaturation : S 최대 값
        • f64MinExposure : V 최소 값
        • f64MaxExposure : V 최대 값
        • f64MinHue : H 최소 값
        • f64MaxHue : H 최대 값
        • f64IntensityActivationRate : Batch 마다 적용되는 Intensity 활성화 비율
    7. Gradation
      • EnableGradation(bool)
      • SetGradationParam(double f64GradationMinAlpha = 0., double f64GradationMaxAlpha = .5, double f64GradationActivationRate = 1.)
        • f64GradationMinAlpha : 최소 밝기 변화율
        • f64GradationMaxAlpha : 최대 밝기 변화율
        • f64GradationActivationRate : Batch 마다 적용되는 Gradation 활성화 비율
    8. Emphasize
      • EnableEmphasize(bool)
      • SetEmphasizeParam(int64_t i64MinimumKernelSize = 1, int64_t i64MaximumKernelSize = 3, double f64MinimumFactor = 0., double f64MaximumFactor = 1., double f64EmphasizeActivationRate = 1.)
        • i64MinimumKernelSize : 최소 필터 사이즈 크기
        • i64MaximumKernelSize : 최대 필터 사이즈 크기
        • f64MinimumFactor : 최소 Factor
        • f64MaximumFactor : 최대 Factor
        • f64EmphasizeActivationRate : Batch 마다 적용되는 Emphasize 활성화 비율
    9. Gaussian Blur
      • EnableGaussianBlur(bool)
      • SetGaussianBlurParam(int64_t i64MinKernelSize = 1, int64_t i64MaxKernelSize = 3, double f64GaussianBlurActivationRate = 1.)
        • i64MinKernelSize : 최소 필터 크기
        • i64MaxKernelSize : 최대 필터 크기
        • f64GaussianBlurActivationRate : Batch 마다 적용되는 Gaussian Blur 활성화 비율
    10. Gaussian Noise
      • EnableGaussianNoise(bool)
      • SetGaussianNoiseParam(double f64MinMean = 0., double f64MaxMean = 0., double f64MinStdev = 0., double f64MaxStdev = .04, double f64GaussianNoiseActivationRate = 1.)
        • f64MinMean : 가우시안 분포의 최소 평균
        • f64MaxMean : 가우시안 분포의 최대 평균
        • f64MinStdev : 가우시안 분포의 최소 표준 편차
        • f64MaxStdev : 가우시안 분포의 최대 표준 편차
        • f64GaussianNoiseActivationRate : Batch 마다 적용되는 Gaussian Noise 활성화 비율
    11. Alpha Blend Mask
      • EnableAlphaBlendMask(bool)
      • SetAlphaBlendMaskParam(double f64MinAlphaBlendMaskRatioX = 0.05, double f64MaxAlphaBlendMaskRatioX = .1, double f64MinAlphaBlendMaskRatioY = 0.05, double f64MaxAlphaBlendMaskRatioY = .1, double f64MinAlphaBlendMaskValue = 0., double f64MaxAlphaBlendMaskValue = 1., double f64MinAlphaBlendMaskBlendRatio = 0.6, double f64MaxAlphaBlendMaskBlendRatio = 1., double f64AlphaBlendMaskActivationRate = .5, int64_t i64MinAlphaBlendMaskCount = 1, int64_t i64MaxAlphaBlendMaskCount = 2)
        • f64MinAlphaBlendMaskRatioX : X 방향 최소 섞는 범위 * f64MaxAlphaBlendMaskRatioX : X 방향 최대 섞는 범위 * f64MinAlphaBlendMaskRatioY : Y 방향 최소 섞는 범위 * f64MaxAlphaBlendMaskRatioY : Y 방향 최대 섞는 범위 * f64MinAlphaBlendMaskValue : 섞는 최소 값 * f64MaxAlphaBlendMaskValue : 섞는 최대 값 * f64MinAlphaBlendMaskBlendRatio : 최소 섞는 비율 * f64MaxAlphaBlendMaskBlendRatio : 최대 섞는 비율 * f64AlphaBlendMaskActivationRate : 섞는 활성화 비율 * i64MinAlphaBlendMaskCount : 최소 섞는 개수 * i64MaxAlphaBlendMaskCount : 최대 섞는 개수
    12. Perspective
      • EnablePerspective(bool)
      • SetPerspectiveParam(double f64MinPerspectiveRatio = .0, double f64MaxPerspectiveRatio = .1, double f64PerspectiveActivationRate = 1.)
        • f64MinPerspectiveRatio : Projection quad 점 4개의 대한 최소 변형 비율
        • f64MaxPerspectiveRatio : Projection quad 점 4개의 대한 최대 변형 비율
        • f64PerspectiveActivationRate : Batch 마다 적용되는 Perspective 활성화 비율
    13. Quarter Rotation
      • EnableQuarterRotation(bool)
      • SetQuarterRotationParam(bool bAngle0 = true, bool bAngle90 = true, bool bAngle180 = true, bool bAngle270 = true, double f64QuarterRotationActivationRate = 1.)
        • bAngle0 : 0도 회전 사용 여부
        • bAngle90 : 90도 회전 사용 여부
        • bAngle180 : 180도 회전 사용 여부
        • bAngle270 : 270도 회전 사용 여부
        • f64QuarterRotationActivationRate : Batch 마다 적용되는 Quarter Rotation 활성화 비율
    14. Rotation
      • EnableRotation(bool)
      • SetRotationParam(double f64MinAngle = -5., double f64MaxAngle = 5., bool bRectMode = false, bool bFitTensor = false, double f64RotationActivationRate = 1.)
        • f64MinAngle : 최소 Rotation 각도 범위
        • f64MaxAngle : 최대 Rotation 각도 범위
        • bRectMode : ROI를 사각형으로만 처리할 지에 대한 여부
        • bFitTensor : 회전하는 이미지 연산 방식 선택
        • f64RotationActivationRate : Batch 마다 적용되는 Rotation 활성화 비율
    15. Scale
      • EnableScale(bool)
      • SetScaleParam(double f64MinScaleRatioX = 0.8, double f64MaxScaleRatioX = 1.2, double f64MinScaleRatioY = 0.8, double f64MaxScaleRatioY = 1.2, bool bPreservingScaleRatio = false, double f64ScaleActivationRate = 1.)
        • f64MinScaleRatioX : 너비 Scale Ratio의 최소
        • f64MaxScaleRatioX : 너비 Scale Ratio의 최대
        • f64MinScaleRatioY : 높이 Scale Ratio의 최소
        • f64MaxScaleRatioY : 높이 Scale Ratio의 최대
        • bPreservingScaleRatio : 늘리는 축의 비율 유지 여부
        • f64ScaleActivationRate : Batch 마다 적용되는 Scale 활성화 비율
    16. Translation
      • EnableTranslation(bool)
      • SetTranslationParam(double f64MinTranslationRatioX = -0.1, double f64MaxTranslationRatioX = 0.1, double f64MinTranslationRatioY = -0.1, double f64MaxTranslationRatioY = 0.1, double f64TranslationActivationRate = 1.)
        • f64MinTranslationRatioX : X 방향으로의 최소 이동 비율
        • f64MaxTranslationRatioX : X 방향으로의 최대 이동 비율
        • f64MinTranslationRatioY : Y 방향으로의 최소 이동 비율
        • f64MaxTranslationRatioY : Y 방향으로의 최대 이동 비율
        • f64TranslationActivationRate : Batch 마다 적용되는 Translation 활성화 비율
    17. Cutout
      • EnableCutout(bool)
      • SetCutoutParam(double f64MinCutoutRatioX = 0.05, double f64MaxCutoutRatioX = .1, double f64MinCutoutRatioY = 0.05, double f64MaxCutoutRatioY = .1, double f64CutoutActivationRate = .5, int64_t i64MinCutoutCount = 1, int64_t i64MaxCutoutCount = 2)
        • f64CutoutActivationRate : Cutout 활성화 비율
        • f64MinCutoutRatioX : X 방향으로의 최소 cutout되는 비율
        • f64MaxCutoutRatioX : X 방향으로의 최대 cutout되는 비율
        • f64MinCutoutRatioY : Y 방향으로의 최소 cutout되는 비율
        • f64MaxCutoutRatioY : Y 방향으로의 최대 cutout되는 비율
        • i64MinCutoutCount : 최소 cutout 개수
        • i64MaxCutoutCount : 최대 cutout 개수
  3. 모든 옵션을 활성화 시 Augmentation 동작 순서는 아래와 같습니다.
    1. Mix Method
    2. Resized Crop
    3. Horizontal Flip
    4. Vertical Flip
    5. Adjustment
    6. Intensity
    7. Gradation
    8. Emphasize
    9. Gaussian Blur
    10. Gaussian Noise
    11. Alpha Blend Mask
    12. Perspective
    13. Quarter Rotation
    14. Rotation
    15. Scale
    16. Translation
    17. Cutout

2.4.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;
CAugmentationSpec augSpec;

augSpec.SetCommonActivationRate(0.5);
augSpec.SetCommonInterpolationMethod(FLImaging::ImageProcessing::EInterpolationMethod_Bilinear);
augSpec.EnableRotation(true);
augSpec.SetRotationParam(-45.0, 45.0, false, true, 1.0);
augSpec.EnableHorizontalFlip(true);
augSpec.EnableVerticalFlip(true);

semanticSegmentationDL.SetLearningAugmentationSpec(&augSpec);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();
CAugmentationSpec augSpec = new CAugmentationSpec();

augSpec.SetCommonActivationRate(0.5);
augSpec.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear);
augSpec.EnableRotation(true);
augSpec.SetRotationParam(-45.0, 45.0, false, true, 1.0);
augSpec.EnableHorizontalFlip(true);
augSpec.EnableVerticalFlip(true);

semanticSegmentationDL.SetLearningAugmentationSpec(augSpec);
semanticSegmentationDL = CSemanticSegmentationDL()
augSpec = CAugmentationSpec()

augSpec.SetCommonActivationRate(0.5)
augSpec.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear)
augSpec.EnableRotation(True)
augSpec.SetRotationParam(-45.0, 45.0, False, True, 1.0)
augSpec.EnableHorizontalFlip(True)
augSpec.EnableVerticalFlip(True)

semanticSegmentationDL.SetLearningAugmentationSpec(augSpec)

2.4.4 GUI에서 설정 방법

Augmentation setting

Fig. Augmentation 설정

3 선택 옵션

3.1 모델/메모리 초기화

3.1.1 개요

3.1.2 API

3.1.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

///////////////////////////////////
// 필수 or 선택 옵션 설정
///////////////////////////////////

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후, 학습 데이터 ClearLearnedData 함수로 초기화
semanticSegmentationDL.ClearLearnedData();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

///////////////////////////////////
// 필수 or 선택 옵션 설정
///////////////////////////////////

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후, 학습 데이터 ClearLearnedData 함수로 초기화
semanticSegmentationDL.ClearLearnedData();
semanticSegmentationDL = CSemanticSegmentationDL()

###################################
## 필수 or 선택 옵션 설정
###################################

semanticSegmentationDL.Learn()
semanticSegmentationDL.Stop()

# 학습 종료 후, 학습 데이터 ClearLearnedData 함수로 초기화
semanticSegmentationDL.ClearLearnedData()

3.1.4 GUI에서 실행 방법

Clear Learned Data

Fig. 모델/메모리 초기화 버튼

3.2 Interpolation 설정

3.2.1 개요

3.2.2 API

3.2.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.SetInterpolationMethod(FLImaging::ImageProcessing::EInterpolationMethod_Bilinear);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.SetInterpolationMethod(EInterpolationMethod.Bilinear);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.SetInterpolationMethod(EInterpolationMethod.Bilinear)

3.2.4 GUI에서 설정 방법

Set Interpolation

Fig. Interpolation 방식 설정

3.3 Memory Saving Mode 설정

3.3.1 개요

  1. 입력 이미지 셋이 매우 많을 경우 학습용 Tensor로 모두 변환할 메모리 용량이 부족한 경우에 사용합니다.
    1. 학습/추론 중 Mini Batch 단위로 Tensor를 생성합니다.
    2. 메모리가 여유로운 케이스에서 사용하여도 무관합니다.

3.3.2 API

3.3.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.EnableMemorySavingMode(true);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.EnableMemorySavingMode(true);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.EnableMemorySavingMode(True)

3.3.4 GUI에서 설정 방법

Set Memory Saving Mode

Fig. Memory Saving Mode 설정

3.4 Save/Load

3.4.1 개요

  1. 학습 결과를 저장 및 로드합니다.
    1. 저장 시 현재 설정하였던 파라미터 정보들이 모두 저장됩니다.
    2. 로드 시 저장하였던 파라미터 정보들이 모두 업데이트 되므로, 추가적인 설정이 필요 없습니다.

3.4.2 API

3.4.3 예제 코드

  1. Save
CSemanticSegmentationDL semanticSegmentationDL;

///////////////////////////////////
// 필수 or 선택 옵션 설정
///////////////////////////////////

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

semanticSegmentationDL.Save(L"FL SS 512 B3.flss");
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

///////////////////////////////////
// 필수 or 선택 옵션 설정
///////////////////////////////////

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

semanticSegmentationDL.Save("FL SS 512 B3.flss");
semanticSegmentationDL = CSemanticSegmentationDL()

###################################
## 필수 or 선택 옵션 설정
###################################

semanticSegmentationDL.Learn()
semanticSegmentationDL.Stop()

semanticSegmentationDL.Save("FL SS 512 B3.flss")
  1. Load
CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.Load(L"FL SS 512 B3.flss");
semanticSegmentationDL.Execute();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.Load("FL SS 512 B3.flss");
semanticSegmentationDL.Execute();
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.Load("FL SS 512 B3.flss")
semanticSegmentationDL.Execute()

3.4.4 GUI에서 설정 방법

  1. Save
    1. 학습 후 GUI의 Save 버튼을 클릭하여 Dialog를 통해 원하는 위치에 모델을 저장합니다.
      • 확장자는 각 모델별로 상이합니다.
Save Button

Fig. Save 버튼

Save File Dialog

Fig. 모델 Save를 위한 Dialog


  1. Load
    1. 저장한 모델을 Load 버튼을 클릭하여 모델 파일을 불러옵니다.
      • Load가 성공되었다면, 바로 추론 동작을 실행할 수 있습니다.
Load Button

Fig. Load 버튼

Set Memory Saving Mode

Fig. 모델 Load를 위한 Dialog


3.5 Batch Processing 설정

3.5.1 개요

3.5.2 API

3.5.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.EnableInferenceBatchProcessing(false);
semanticSegmentationDL.Execute();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.EnableInferenceBatchProcessing(false);
semanticSegmentationDL.Execute();
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.EnableInferenceBatchProcessing(False)
semanticSegmentationDL.Execute()

3.5.4 GUI에서 설정 방법

Set Batch Processing

Fig. Inference Batch Processing 설정

3.6 Auto Save 설정

3.6.1 개요

  1. 학습 중 설정한 조건에 맞으면 자동으로 저장하는 기능
    1. 자동저장을 시작할 조건을 표현식으로 처리합니다.
    2. 공통적으로 사용가능한 변수로 epoch, cost, validation(accuracy), metric 을 설정할 수 있습니다.
      1. 대소문자 구분은 무시됩니다.
      2. Validation은 accuracy와 같습니다.
    3. Min, max 함수 키워드 지원 가능합니다.
  2. 각 알고리즘별 특이 키워드
    1. Classifier
      1. Metric과 같은 값으로 f1score가 있습니다.
    2. Semantic Segmentation
      1. 추가 validation/accuracy 값으로 validation.ze, accuracy.ze가 있습니다.
      2. Metric은 mIoU로 대체하여 사용할 수 있습니다.
      3. 추가 metric은 metric.ze, mIou.ze가 있습니다.
    3. Object Detection
      1. 추가 cost 값으로 avgcost가 있습니다.
      2. Metric은 mAP로 대체하여 사용할 수 있습니다.
    4. Character Based OCR
      1. Semantic segmentation과 같은 값을 가집니다.
        1. 추가 validation/accuracy 값으로 validation.ze, accuracy.ze가 있습니다.
        2. Metric은 mIoU로 대체하여 사용할 수 있습니다.
        3. 추가 metric은 metric.ze, mIou.ze가 있습니다.
    5. String Based OCR
      1. Metric과 같은 값으로 (1-NED + mAP) / 2 가 있습니다.
    6. Anomaly Detection
      1. 추가 변수 및 변수 대체값 없습니다.
    7. Generative Adversarial Network
      1. Metric과 같은 값으로 Validation Epoch * (SSIM + PDV) 가 있습니다.
    8. Generative Adversarial Network Inpainting
      1. Metric과 같은 값으로 Validation Epoch * (SSIM + MRQ) 가 있습니다.

3.6.2 API

  1. 기본 설정
  1. CAutoSaveSpec 설정

3.6.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;
CAutoSaveSpec autoSave;
CFLString<wchar_t> flsErrorSymbol;

autoSave.EnableAutoSave(true);
autoSave.SetAutoSavePath(L"FL SS.flss");
autoSave.SetAutoSaveCondition(L"epoch >= 100 & (cost < min('cost') | miou.ze > max('miou.ze'))");

// Error Symbol 옵션을 생략 가능
semanticSegmentationDL.SetLearningAutoSaveSpec(autoSave, &flsErrorSymbol);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();
CAutoSaveSpec autoSave = new CAutoSaveSpec();
StringBuilder strErrorSymbol = new StringBuilder();

autoSave.EnableAutoSave(true);
autoSave.SetAutoSavePath("FL SS.flss");
autoSave.SetAutoSaveCondition("epoch >= 100 & (cost < min('cost') | miou.ze > max('miou.ze'))");

// Error Symbol 옵션을 생략 가능
semanticSegmentationDL.SetLearningAutoSaveSpec(autoSave, ref strErrorSymbol);
semanticSegmentationDL = CSemanticSegmentationDL()
autoSave = CAutoSaveSpec()
strErrorSymbol = StringBuilder()

autoSave.EnableAutoSave(True)
autoSave.SetAutoSavePath("FL SS.flss")
autoSave.SetAutoSaveCondition("epoch >= 100 & (cost < min('cost') | miou.ze > max('miou.ze'))")

# Error Symbol 옵션을 생략 가능
semanticSegmentationDL.SetLearningAutoSaveSpec(autoSave, strErrorSymbol)

3.6.4 GUI에서 설정 방법

Auto Save Settings

Fig. Auto Save 환경 설정

3.7 Stop Condition 설정

3.7.1 개요

  1. 학습 중 특정 조건에 도달 시 학습을 종료하는 기능
    1. Auto Save와 동일하게 표현식을 사용하여 처리합니다.

3.7.2 API

3.7.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.SetLearningStopCondition(L"epoch >= 10 & (cost <= 0 | accuracy >= 1 | miou >= 1)");
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.SetLearningStopCondition("epoch >= 10 & (cost <= 0 | accuracy >= 1 | miou >= 1)");
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.SetLearningStopCondition("epoch >= 10 & (cost <= 0 | accuracy >= 1 | miou >= 1)")

3.7.4 GUI에서 설정 방법

Learning Stop Condition Settings

Fig. Stop Condition 설정

3.8 Optimal State Preservation 설정

3.8.1 개요

  1. 학습을 종료한 후, 수동으로 Save를 할 때, 어떠한 상태를 저장할 지 설정합니다.
    1. true라면 최적의 학습 상태가 파일에 저장됩니다.
      1. Validation Set이 없는 경우엔 cost값이 최소가 된 지점을 저장합니다.
      2. Validation Set이 있는 경우엔 metric값이 최대가 된 지점을 저장합니다.
    2. false라면 마지막 학습 상태가 파일에 저장됩니다.

3.8.2 API

3.8.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.EnableOptimalLearningStatePreservation(false);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.EnableOptimalLearningStatePreservation(false);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.EnableOptimalLearningStatePreservation(False)

3.8.4 GUI에서 설정 방법

Optimal State Preservation

Fig. Optimal Learning State Preservation 설정

3.9 Class Equalization 설정

3.9.1 개요

3.9.2 API

3.9.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.EnableClassEqualization(false);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.EnableClassEqualization(false);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.EnableClassEqualization(False)

3.9.4 GUI에서 설정 방법

Class Equalization

Fig. Class Equalization 설정

3.10 Preprocessing 설정

3.10.1 개요

3.10.2 API

3.10.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;
std::vector<Foundation::CAlgorithmFeatureBase*> vctAlgorithms;

CLowLuminanceCorrectionType2 lowLuminanceCorrectionType2;
vctAlgorithms.push_back(&lowLuminanceCorrectionType2);

CFLAutoShadingCorrection flAutoShadingCorrection;
vctAlgorithms.push_back(&flAutoShadingCorrection);

semanticSegmentationDL.SetImagePreprocessingAlgorithm(vctAlgorithms);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();
List<CAlgorithmFeatureBase> listAlgorithms = new List<CAlgorithmFeatureBase>();

CLowLuminanceCorrectionType2 lowLuminanceCorrectionType2 = new CLowLuminanceCorrectionType2();
listAlgorithms.Add(lowLuminanceCorrectionType2);

CFLAutoShadingCorrection flAutoShadingCorrection = new CFLAutoShadingCorrection();
listAlgorithms.Add(flAutoShadingCorrection);

semanticSegmentationDL.SetImagePreprocessingAlgorithm(listAlgorithms);
semanticSegmentationDL = CSemanticSegmentationDL()
listAlgorithms = List[CAlgorithmFeatureBase]()

lowLuminanceCorrectionType2 = CLowLuminanceCorrectionType2()
listAlgorithms.Add(lowLuminanceCorrectionType2)

flAutoShadingCorrection = CFLAutoShadingCorrection()
listAlgorithms.Add(flAutoShadingCorrection)

semanticSegmentationDL.SetImagePreprocessingAlgorithm(listAlgorithms)

3.10.4 GUI에서 설정 방법

Preprocessing

Fig. Preprocessing 설정

3.11 Image Tiling 설정

3.11.1 개요

3.11.2 API

3.11.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.SetImageTilingMode(ETilingMode_SingleAxisTiling_ProportionalFit);
semanticSegmentationDL.SetImageTilingOverlapRatio(0.3);
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.SetImageTilingMode(ETilingMode.SingleAxisTiling_ProportionalFit);
semanticSegmentationDL.SetImageTilingOverlapRatio(0.3);
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.SetImageTilingMode(ETilingMode.SingleAxisTiling_ProportionalFit)
semanticSegmentationDL.SetImageTilingOverlapRatio(0.3)

3.11.4 GUI에서 설정 방법

Image Tiling

Fig. Image Tiling 설정

3.12 Reset Best Score 설정

3.12.1 개요

3.12.2 API

3.12.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후 Best Record 초기화
semanticSegmentationDL.ResetBestScore();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후 Best Record 초기화
semanticSegmentationDL.ResetBestScore();
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.Learn()
semanticSegmentationDL.Stop()

# 학습 종료 후 Best Record 초기화
semanticSegmentationDL.ResetBestScore()

3.12.4 GUI에서 설정 방법

Best Record Reset

Fig. Best Records Reset

3.13 Pretrained Model 설정

3.13.1 개요

3.13.2 API

3.13.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후 Pretrained Model 생성
semanticSegmentationDL.MakePretrainedModel();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

semanticSegmentationDL.Learn();
semanticSegmentationDL.Stop();

// 학습 종료 후 Pretrained Model 생성
semanticSegmentationDL.MakePretrainedModel();
semanticSegmentationDL = CSemanticSegmentationDL()

semanticSegmentationDL.Learn()
semanticSegmentationDL.Stop()

# 학습 종료 후 Pretrained Model 생성
semanticSegmentationDL.MakePretrainedModel()

3.13.4 GUI에서 설정 방법

Pretrained Model

Fig. Make Pretrained Model 설정

3.14 Pretrained Model 사용

3.14.1 개요

3.14.2 API

3.14.3 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;
	
// Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL::EModel_FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL::EModelVersion_FLSegNet_V1_512_B3);
semanticSegmentationDL.EnablePretrainedModelFile(true);
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(true);

//////////////////////////////////////////
//////////////////////////////////////////
// Learn 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
//////////////////////////////////////////
semanticSegmentationDL.Learn();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

// Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3);
semanticSegmentationDL.EnablePretrainedModelFile(true);
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(true);

//////////////////////////////////////////
//////////////////////////////////////////
// Learn 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
//////////////////////////////////////////
semanticSegmentationDL.Learn();
semanticSegmentationDL = CSemanticSegmentationDL()

# Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet)
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3)
semanticSegmentationDL.EnablePretrainedModelFile(True)
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(True)
	
##########################################
##########################################
## Learn 옵션 셋팅 후 Learn 수행
##########################################
##########################################
semanticSegmentationDL.Learn()
CSemanticSegmentationDL semanticSegmentationDL;

// Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL::EModel_FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL::EModelVersion_FLSegNet_V1_512_B3);
semanticSegmentationDL.EnablePretrainedModelFile(true);
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(false);
semanticSegmentationDL.SetPretrainModelFilePath(L"C://FLSegNet V1 B3 PT.flcf");

//////////////////////////////////////////
//////////////////////////////////////////
// Learn 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
//////////////////////////////////////////
semanticSegmentationDL.Learn();
CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

// Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3);
semanticSegmentationDL.EnablePretrainedModelFile(true);
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(false);
semanticSegmentationDL.SetPretrainModelFilePath("C://FLSegNet V1 B3 PT.flcf");

//////////////////////////////////////////
//////////////////////////////////////////
// Learn 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
//////////////////////////////////////////
semanticSegmentationDL.Learn();
semanticSegmentationDL = CSemanticSegmentationDL()

# Pretrained Model 사용을 위해 FLSegNet으로 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet)
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3)
semanticSegmentationDL.EnablePretrainedModelFile(True)
semanticSegmentationDL.EnableIntrinsicPretrainedModelFile(False)
semanticSegmentationDL.SetPretrainModelFilePath("C://FLSegNet V1 B3 PT.flcf")

##########################################
##########################################
## Learn 옵션 셋팅 후 Learn 수행
##########################################
##########################################
semanticSegmentationDL.Learn()

3.14.4 GUI에서 사용하는 법

Pretrained Model

Fig. Pretrained Model

4 학습 및 추론

4.1 개요

  1. 앞서 설명한 옵션들에 대한 설정을 완료한 후 동작합니다.
    1. 모델을 Load 한 경우 Save 당시의 파라미터가 모두 동기화 되므로 Image를 제외한 옵션 입력이 필요 없습니다.
    2. 추론의 경우 학습이 되어있는 경우에만 활성화되어 학습을 하지 않으면 동작하지 않습니다.
    3. 학습이 시작되면 설정된 Epoch이나, Stop Condition에 부합할 때까지 진행됩니다. 또는 Dialog 창에서 stop 버튼으로 사용자가 원하는 경우에 학습을 중단할 수 있습니다.

4.2 학습

  1. 각 모델별 라벨링 방법으로 학습 이미지 및 검증 이미지를 설정합니다.
    1. 검증 이미지는 오버 피팅 방지를 위해 학습에 사용되지 않은 데이터 셋을 사용하는 것을 권장합니다.
    2. 학습 이미지, 검증 이미지 비율은 9:1 ~ 8:2 범위로 사용하는 것을 권장합니다.
  2. 추론할 데이터에 맞게 세부 옵션들을 설정합니다.
    1. Model 설정
      1. 검사 대상의 정밀도에 따라 모델을 설정합니다.
    2. 검사할 이미지의 상태 변화에 따른 Augmentation 기법을 적용합니다.
      1. 검사할 위치가 이동된다면 Translation, 조명 밝기가 변한다면 Adjustment 또는 Intensity 등 검사 이미지의 상태 변화에 맞는 Augmentation을 적용합니다.
    3. Tiling Mode
      1. 검사 대상의 비율 및 크기 변화에 민감한 정도에 따라 Tiling 옵션을 설정합니다.
    4. 이 외의 선택 옵션들
  3. 종료저장 조건을 설정합니다.
    1. 조건을 설정하지 않을 경우 각 모델별로 설정된 기본값으로 동작합니다.
  4. 학습을 진행합니다.
    1. 이미 학습이 진행된 상태에서 학습 진행 시 초기화 되지않고 이전 상태에서 추가적으로 학습이 진행됩니다.
      1. Load 이후에 학습 시에도 추가 학습으로 진행됩니다.
      2. 추가 학습 시에는 Model과 Tiling Mode에 대한 옵션을 변경할 수 없습니다.

4.3 추론

  1. Learn 또는 Load를 진행합니다.
    1. IsLearned() 함수로 학습 여부를 확인합니다.
  2. 검사 이미지를 설정합니다.
  3. 학습된 모델로 추론을 진행합니다.
  4. 추론 결과는 이미지 형태로 얻을 수 있습니다.
    1. GetInferenceResultImage로 결과 이미지를 얻습니다.

4.4 API

4.5 예제 코드

CSemanticSegmentationDL semanticSegmentationDL;

// 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL::EModel_FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL::EModelVersion_FLSegNet_V1_512_B3);

//////////////////////////////////////////
// 학습 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
semanticSegmentationDL.Learn();

if(!semanticSegmentationDL.IsLearned())
{
  // 학습 실패 예외처리
}

//////////////////////////////////////////
// 추론 옵션 셋팅 후 Execute 수행
//////////////////////////////////////////
semanticSegmentationDL.Execute();

// 추론 결과 얻어오기
CFLImage* resultImage = (CFLImage*)semanticSegmentationDL.GetInferenceResultImage();

CSemanticSegmentationDL semanticSegmentationDL = new CSemanticSegmentationDL();

// 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet);
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3);

//////////////////////////////////////////
// 학습 옵션 셋팅 후 Learn 수행
//////////////////////////////////////////
semanticSegmentationDL.Learn();

if(!semanticSegmentationDL.IsLearned())
{
  // 학습 실패 예외처리
}

//////////////////////////////////////////
// 추론 옵션 셋팅 후 Execute 수행
//////////////////////////////////////////
semanticSegmentationDL.Execute();

// 추론 결과 얻어오기
CFLImage resultImage = semanticSegmentationDL.GetInferenceResultImage();
semanticSegmentationDL = CSemanticSegmentationDL()

# 모델 설정
semanticSegmentationDL.SetModel(CSemanticSegmentationDL.EModel.FLSegNet)
semanticSegmentationDL.SetModelVersion(CSemanticSegmentationDL.EModelVersion.FLSegNet_V1_512_B3)
	
##########################################
## 학습 옵션 셋팅 후 Learn 수행
##########################################
semanticSegmentationDL.Learn()
	
if semanticSegmentationDL.IsLearned() == False:
	# 학습 실패 예외처리	

##########################################
# 추론 옵션 셋팅 후 Execute 수행
##########################################
semanticSegmentationDL.Execute()

# 추론 결과 얻어오기
resultImage = semanticSegmentationDL.GetInferenceResultImage()