Classifier DL

1 개요

2 Classifier 사용 방법

1 데이터 셋 준비

  1. MNIST와 같이 전체 이미지를 분류 범주로 나눌 경우는 학습 이미지로 들어온 파일 이름을 파싱하여 맨 앞의 숫자를 기준으로 labeling 하여 학습을 진행합니다.

    1. 해당 방식으로 라벨링을 하고 싶은 경우 동일한 카테고리의 이미지들이 담겨있는 폴더 이름만 설정하여 일괄적으로 처리가 가능합니다.
    2. 아래와 같이 폴더 이름을 앞에 카테고리 번호로 설정한 후 폴더를 이미지 뷰어에 로드하거나 폴더 경로를 학습 이미지로 설정하면 아래와 같이 번호를 label number로 인식하여 학습을 진행합니다.
    3. 아래의 예시에서 원래 파일 이름은 "241.jpg" 였지만, 해당 파일이 들어있는 폴더를 로드하면 폴더 앞의 번호가 1이기 때문에 1과 _이 삽입되어 "1_241.jpg"를 이름으로 뷰어에서 인식하게 됩니다.
폴더 이름으로 카테고리 분류

Fig. 폴더 이름으로 카테고리 분류

폴더 안에 있는 이미지들의 Page name

Fig. 폴더 안에 있는 이미지들의 Page name


  1. 또 다른 방식은 아래와 같이 이미지 내에 분류하고 싶은 영역에 대해 ROI를 설정하면, Crop 없이 학습이 가능합니다.
    1. Labeling은 figure의 name을 설정하여 category 분류를 할 수 있습니다.
    2. 이때 figure name은 위와 같이 해당 항목의 번호 + (항목 이름)으로 저장하면 파싱하여 figure name 앞의 번호는 class number로 처리하고, 괄호 안의 이름은 class name으로 인식하여 아래와 같이 learned label이 처리된 것을 확인할 수 있습니다.
Figure을 사용한 Labeling

Fig. Figure을 사용한 Labeling

학습 후 분류된 카테고리에 대한 정보 출력

Fig. 학습 후 분류된 카테고리에 대한 정보 출력

2 학습

2.2.1. 학습 이미지 설정
2.2.2. 검증 이미지 설정(선택)
  1. 검증 지표
    1. F1 Score(Metric)
      1. 정밀도(Precision)와 재현율(Recall)을 사용하는 평가 지표입니다.
        1. 정밀도
          1. 분류 모델이 Positive로 판정한 것 중, 실제로 Positive인 샘플의 비율입니다.
          2. Positive로 검출된 결과가 얼마나 정확한지를 나타냅니다.
          3. 계산하는 식은 아래와 같습니다.

            Precision=TPTP+FP{Precision} = \frac{TP}{TP + FP}

        2. 재현율
          1. 실제 Positive 샘플 중을 모델을 통해 Positive로 판정한 비율입니다.
          2. 분류 모델이 실제 Positive한 클래스를 얼마나 빠지지 않고 판정하는지를 나타냅니다.
          3. 계산하는 식은 아래와 같습니다.

            Recall=TPTP+FN{Recall} = \frac{TP}{TP + FN}

      2. 각 클래스 별 정밀도와 재현율을 구하여 아래의 식과 같이 F1 score를 구합니다.

        F1Score=2×Precision+RecallPrecision×Recall{F1Score} = 2 \times \frac{Precision + Recall}{Precision \times Recall}

      3. 정밀도와 재현율이 높을수록 더 높은 값이 나오고, 클래스별 데이터가 불균형하여도 해당 지표가 높다면 신뢰할 수 있다고 할 수 있습니다.
    2. Accuracy(Validation)
      1. Validation 데이터에 대한 전체 예측 중 정확하게 분류한 객체들의 분류입니다.
        1. 계산하는 식은 아래와 같습니다.

          Accuracy=TP+TNTP+TN+FP+FN{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}

      2. 클래스별 데이터가 균형적이라면 이 지표는 충분히 의미가 있습니다.
      3. 클래스별 데이터가 불균형한 Validation 데이터라면 해당 지표가 높아도 신뢰도가 떨어질 수 있습니다.
      Confusion matrix

      Fig. Confusion Matrix
2.2.4. 옵티 마이저 설정
2.2.5. Augmentation 설정(선택)
  1. Classifier는 Augmentation 유형 중에서 Mix Method(ObjectMix, CutMix, MixUp, Mosaic)은 지원하지 않습니다.
2.2.6. 학습 수행
  1. Classifier는 객체에 대한 분류 알고리즘이기 때문에 다른 AI 알고리즘에 비해 validation 값이 1로 수렴하는 것이 용이합니다.
  2. 따라서 최대한 좋은 학습 결과를 얻고 싶다면 validation 값이 1이면 학습을 종료하도록 stop condition을 설정하는 것을 권장합니다.
  3. 추천 종료 조건
    1. accuracy >= 1 || f1score >= 1
2.2.7. 조건 식
  1. 종료 조건(Stop Condition) & 자동 저장(Auto Save)에서 사용 가능한 조건 식 입니다.
  2. Common Conditional Expression
  3. Classifier Conditonal Expression
    변수명 설명 Stop Condition 예시 Auto Save 예시
    f1score, f1, f1score F1-Score 지표입니다. 정밀도(Precision)와 재현율(Recall)을 이용한 조화 평균입니다. 정밀도와 재현율이 모두 높아야 높은 값이 나옵니다. 0 ~ 1 범위를 가지며 1로 갈수록 좋은 결과를 나타냅니다. cost <= 0.3 & f1score >= 1 epoch >= 10 & f1score >= max('f1score') & f1score > 0
    accuracy 정확도 입니다. 맞춘 개수 / 총 개수 로 계산 되어집니다. 0 ~ 1 범위를 가지며 1로 갈수록 좋은 결과를 나타냅니다. cost <= 0 | accuracy >= 1 epoch >= 10 & accuracy >= max('accuracy') & accuracy > 0
    metric F1score가 metric으로 사용됩니다. cost <= 0 | metric >= 1 epoch >= 10 & metric >= max('metric') & metric > 0
    validation accuracy가 validation으로 사용됩니다. cost <= 0 | validation >= 1 epoch >= 10 & validation >= max('validation') & validation > 0
  4. GUI 에서 설정 방법
    1. 종료 조건 식 설정
      1. cost <= 0 | validation >= 1 | metric >= 1
      Graph View Result

      Fig. GUI에서 종료 조건 설정
    2. 자동 저장 조건 식설정
      1. epoch >= 10 & metric >= max('metric') & metric > 0
      Graph View Result

      Fig. GUI에서 자동 저장 조건 설정

3 추론

  1. 추론 이미지 & 결과 이미지 설정(추론 이미지 설정 관련 주의 사항)
  2. 추론 수행
  3. 추론 결과 옵션 설정

4 Save/Load

  1. Save/Load
    • 모델파일을 저장하거나 불러옵니다.
    • 확장자는 .flcf입니다.

3 필수 옵션

1 Learn 이미지 설정

2 모델 설정

1 모델/버전

  1. Classifier DL에서 사용할 모델 및 모델의 버전을 설정합니다.
    1. 모델의 크기도 결정됩니다.
  2. 지원 모델
    1. FLNet(V1 32 B1~B3/V1 64 B1~B3/V1 128 B1~B3/V1 256 B1~B3)
      1. 포스로직에서 개발 복잡한 Dataset에 대해서도 좋은 성능을 내는 모델입니다. 사용자의 선택에 따라 네트워크 깊이 및 input size를 조절하여 더 정교한 학습을 가능하게 합니다.
    2. FL CF C(V1 32/V1 64)
      1. 포스로직에서 자체적으로 개발한 모델로 상대적으로 단순한 MNIST와 같은 데이터셋에 대해 적합합니다. Input size가 크지 않기 때문에 다른 모델들에 비해 한 epoch 당 training 속도가 빠릅니다.
    3. FLNet FPT(FLSegNet V1 B1~B5/R-FLNet V1)
      1. 다른 알고리즘에서 사용하는 모델을 Classifier에 맞게 변형한 버전입니다. 포스로직만의 효율적인 최신 AI 모델 설계 구조를 바탕으로 구현된 정밀한 결과를 도출합니다.
    4. ResNet(L50 224)
    5. VGGNet(V1 224)
    6. AlexNet(V1 227)
    7. LeNet(V1 28)
    8. Inception(V1 224)

2 API

3 예제 코드

CClassifierDL classifierDL;

classifierDL.SetModel(CClassifierDL::EModel_FLNet);
classifierDL.SetModelVersion(CClassifierDL::EModelVersion_FLNet_V1_256_B3);
CClassifierDL classifierDL = new CClassifierDL();

classifierDL.SetModel(CClassifierDL.EModel.FLNet);
classifierDL.SetModelVersion(CClassifierDL.EModelVersion.FLNet_V1_256);
classifierDL = CClassifierDL()

classifierDL.SetModel(CClassifierDL.EModel.FLNet)
classifierDL.SetModelVersion(CClassifierDL.EModelVersion.FLNet_V1_256)

4 GUI에서 설정 방법

GUI에서 사용할 모델을  설정하는 Dropdown List

Fig. GUI에서 사용할 모델을 설정하는 Dropdown List

GUI에서 사용할 모델 버전을 설정하는 Dropdown List

Fig. GUI에서 사용할 모델 버전을 설정하는 Dropdown List

3 추론 필수 옵션

4 선택 옵션

1 학습 선택 옵션

  1. 검증 이미지 설정
    • 검증 이미지를 설정합니다. 검증 이미지는 라벨링이 되어있어야 합니다.
  2. 검증 옵션 설정
  3. 옵티 마이저 설정
  4. Augmentation 설정
  5. Augmentation Preset 설정
    1. Preset 설정 가이드

    2. 클래스 별로 Augmentation을 독립적으로 설정 할 수 있는 기능입니다.

    3. 특정 클래스는 회전되는게 불량이고 다른 특정 클래스는 회전이 불량이 아닌 경우 Augmentation을 클래스 별로 적용하여 더 강인한 모델로 학습시킬 수 있습니다.

    4. API

      • SetLearningAugmentationPreset(CFLArray<CFLBase*>& flaAugPreset)
        • AugPreset을 설정합니다.
        • CFLBase 포인터는 반드시 CAugmentationPreset으로 할당되어있어야 합니다.
      • SetLearningAugmentationPreset(int32_t i32Index, CAugmentationPreset& augPreset)
        • 해당 Index의 AugmentationPreset을 설정합니다.
      • AddLearningAugmentationPreset(CFLArray<CFLBase*>& flaAugPreset)
        • AugPreset을 추가합니다.
        • CFLBase 포인터는 반드시 CAugmentationPreset으로 할당되어있어야 합니다.
      • AddLearningAugmentationPreset(CAugmentationPreset& augPreset)
        • AugmentationPreset을 추가합니다.
      • GetLearningAugmentationPreset(int32_t i32Index, CAugmentationPreset& augPreset)
        • 해당 Index의 AugmentationPreset을 가져옵니다.
      • GetLearningAugmentationPresetCount()
        • AugmentationPreset 개수를 가져옵니다.
      • RemoveLearningAugmentationPreset(int32_t i32Index)
        • 해당 Index의 AugmentationPreset을 제거합니다.
      • RemoveAllLearningAugmentationPreset()
        • 모든 AugmentationPreset을 제거합니다.
    5. 예제 코드

      CClassifierDL classifier;
      /*
      classifier Setting 코드...
      */
      
      /*
      Common Aug는 활성화만 처리, 0번 클래스에 로테이션, 1번 클래스에 스케일 Augmentaiton 개별 적용
      */
      CAugmentationSpec augSpec1;
      
      augSpec1.EnableAugmentation(true);
      augSpec1.SetCommonActivationRate(1.000000);
      augSpec1.SetCommonIoUThreshold(0.000000);
      augSpec1.SetCommonInterpolationMethod(EInterpolationMethod_Bilinear);
      
      augSpec1.EnableRotation(true);
      augSpec1.SetRotationParam(-30.000000, 30.000000, false, false, 1.000000);
      CAugmentationPreset AugmentationPreset1;
      CFLArray<int32_t> flaClassNum1;
      flaClassNum1.PushBack(0);
      flaClassNum1.PushBack(1);
      AugmentationPreset1.SetClassNumbers(flaClassNum1);
      AugmentationPreset1.SetName(L"Class 0");
      AugmentationPreset1.SetAugmentationSpec(augSpec1);
      classifier.AddLearningAugmentationPreset(AugmentationPreset1);
      CAugmentationSpec augSpec2;
      
      augSpec2.EnableAugmentation(true);
      augSpec2.SetCommonActivationRate(0.500000);
      augSpec2.SetCommonIoUThreshold(0.000000);
      augSpec2.SetCommonInterpolationMethod(EInterpolationMethod_Bilinear);
      
      augSpec2.EnableRotation(true);
      augSpec2.SetRotationParam(-180.000000, 180.000000, false, false, 1.000000);
      
      CAugmentationPreset AugmentationPreset2;
      CFLArray<int32_t> flaClassNum2;
      flaClassNum2.PushBack(2);
      AugmentationPreset2.SetClassNumbers(flaClassNum2);
      AugmentationPreset2.SetName(L"Class 2");
      AugmentationPreset2.SetAugmentationSpec(augSpec2);
      classifier.AddLearningAugmentationPreset(AugmentationPreset2);
      CAugmentationSpec augSpec3;
      
      augSpec3.EnableAugmentation(true);
      augSpec3.SetCommonActivationRate(1.000000);
      augSpec3.SetCommonIoUThreshold(0.000000);
      augSpec3.SetCommonInterpolationMethod(EInterpolationMethod_Bilinear);
      
      augSpec3.EnableScale(true);
      augSpec3.SetScaleParam(0.670000, 1.500000, 0.670000, 1.500000, true, 1.000000);
      
      CAugmentationPreset AugmentationPreset3;
      CFLArray<int32_t> flaClassNum3;
      flaClassNum3.PushBack(3);
      AugmentationPreset3.SetClassNumbers(flaClassNum3);
      AugmentationPreset3.SetName(L"Class 3");
      AugmentationPreset3.SetAugmentationSpec(augSpec3);
      classifier.AddLearningAugmentationPreset(AugmentationPreset3);
      CAugmentationSpec augSpec4;
      
      augSpec4.EnableAugmentation(true);
      augSpec4.SetCommonActivationRate(1.000000);
      augSpec4.SetCommonIoUThreshold(0.000000);
      augSpec4.SetCommonInterpolationMethod(EInterpolationMethod_Bilinear);
      
      augSpec4.EnableQuarterRotation(true);
      augSpec4.SetQuarterRotationParam(true, true, true, true, 1.000000);
      
      CAugmentationPreset AugmentationPreset4;
      CFLArray<int32_t> flaClassNum4;
      flaClassNum4.PushBack(4);
      flaClassNum4.PushBack(5);
      AugmentationPreset4.SetClassNumbers(flaClassNum4);
      AugmentationPreset4.SetName(L"Class 4,5");
      AugmentationPreset4.SetAugmentationSpec(augSpec4);
      classifier.AddLearningAugmentationPreset(AugmentationPreset4);
      /*
      classifier Learn 수행 코드...
      */
      
      CClassifierDL classifier = new CClassifierDL();
      /*
      classifier Setting 코드...
      */
      
      /*
      Common Aug는 활성화만 처리, 0번 클래스에 로테이션, 1번 클래스에 스케일 Augmentaiton 개별 적용
      */
      CAugmentationSpec augSpec1 = new CAugmentationSpec();
      
      augSpec1.EnableAugmentation(true);
      augSpec1.SetCommonActivationRate(1.000000);
      augSpec1.SetCommonIoUThreshold(0.000000);
      augSpec1.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear);
      
      augSpec1.EnableRotation(true);
      augSpec1.SetRotationParam(-30.000000, 30.000000, false, false, 1.000000);
      
      CAugmentationPreset AugmentationPreset1 = new CAugmentationPreset();
      List<int> flaClassNum1 = new List<int>();
      flaClassNum1.Add(0);
      flaClassNum1.Add(1);
      AugmentationPreset1.SetClassNumbers(flaClassNum1);
      AugmentationPreset1.SetName("Class 0");
      AugmentationPreset1.SetAugmentationSpec(augSpec1);
      classifier.AddLearningAugmentationPreset(AugmentationPreset1);
      CAugmentationSpec augSpec2 = new CAugmentationSpec();
      
      augSpec2.EnableAugmentation(true);
      augSpec2.SetCommonActivationRate(0.500000);
      augSpec2.SetCommonIoUThreshold(0.000000);
      augSpec2.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear);
      
      augSpec2.EnableRotation(true);
      augSpec2.SetRotationParam(-180.000000, 180.000000, false, false, 1.000000);
      
      CAugmentationPreset AugmentationPreset2 = new CAugmentationPreset();
      List<int> flaClassNum2 = new List<int>();
      flaClassNum2.Add(2);
      AugmentationPreset2.SetClassNumbers(flaClassNum2);
      AugmentationPreset2.SetName("Class 2");
      AugmentationPreset2.SetAugmentationSpec(augSpec2);
      classifier.AddLearningAugmentationPreset(AugmentationPreset2);
      CAugmentationSpec augSpec3 = new CAugmentationSpec();
      
      augSpec3.EnableAugmentation(true);
      augSpec3.SetCommonActivationRate(1.000000);
      augSpec3.SetCommonIoUThreshold(0.000000);
      augSpec3.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear);
      
      augSpec3.EnableScale(true);
      augSpec3.SetScaleParam(0.670000, 1.500000, 0.670000, 1.500000, true, 1.000000);
      
      CAugmentationPreset AugmentationPreset3 = new CAugmentationPreset();
      List<int> flaClassNum3 = new List<int>();
      flaClassNum3.Add(3);
      AugmentationPreset3.SetClassNumbers(flaClassNum3);
      AugmentationPreset3.SetName("Class 3");
      AugmentationPreset3.SetAugmentationSpec(augSpec3);
      classifier.AddLearningAugmentationPreset(AugmentationPreset3);
      CAugmentationSpec augSpec4 = new CAugmentationSpec();
      
      augSpec4.EnableAugmentation(true);
      augSpec4.SetCommonActivationRate(1.000000);
      augSpec4.SetCommonIoUThreshold(0.000000);
      augSpec4.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear);
      
      augSpec4.EnableQuarterRotation(true);
      augSpec4.SetQuarterRotationParam(true, true, true, true, 1.000000);
      
      CAugmentationPreset AugmentationPreset4 = new CAugmentationPreset();
      List<int> flaClassNum4 = new List<int>();
      flaClassNum4.Add(4);
      flaClassNum4.Add(5);
      AugmentationPreset4.SetClassNumbers(flaClassNum4);
      AugmentationPreset4.SetName("Class 4,5");
      AugmentationPreset4.SetAugmentationSpec(augSpec4);
      classifier.AddLearningAugmentationPreset(AugmentationPreset4);
      /*
      classifier Learn 수행 코드...
      */
      
      classifier = CClassifierDL()
      '''
      classifier Setting 코드...
      '''
      
      '''
      Common Aug는 활성화만 처리, 0번 클래스에 로테이션, 1번 클래스에 스케일 Augmentaiton 개별 적용
      '''
      augSpec1 = CAugmentationSpec()
      
      augSpec1.EnableAugmentation(True)
      augSpec1.SetCommonActivationRate(1.000000)
      augSpec1.SetCommonIoUThreshold(0.000000)
      augSpec1.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear)
      
      augSpec1.EnableRotation(True)
      augSpec1.SetRotationParam(-30.000000, 30.000000, False, False, 1.000000)
      
      AugmentationPreset1 = CAugmentationPreset()
      flaClassNum1 = List[int]()
      flaClassNum1.Add(0)
      flaClassNum1.Add(1)
      AugmentationPreset1.SetClassNumbers(flaClassNum1)
      AugmentationPreset1.SetName("Class 0")
      AugmentationPreset1.SetAugmentationSpec(augSpec1)
      classifier.AddLearningAugmentationPreset(AugmentationPreset1)
      augSpec2 = CAugmentationSpec()
      
      augSpec2.EnableAugmentation(True)
      augSpec2.SetCommonActivationRate(0.500000)
      augSpec2.SetCommonIoUThreshold(0.000000)
      augSpec2.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear)
      
      augSpec2.EnableRotation(True)
      augSpec2.SetRotationParam(-180.000000, 180.000000, False, False, 1.000000)
      
      AugmentationPreset2 = CAugmentationPreset()
      flaClassNum2 = List[int]()
      flaClassNum2.Add(2)
      AugmentationPreset2.SetClassNumbers(flaClassNum2)
      AugmentationPreset2.SetName("Class 2")
      AugmentationPreset2.SetAugmentationSpec(augSpec2)
      classifier.AddLearningAugmentationPreset(AugmentationPreset2)
      augSpec3 = CAugmentationSpec()
      
      augSpec3.EnableAugmentation(True)
      augSpec3.SetCommonActivationRate(1.000000)
      augSpec3.SetCommonIoUThreshold(0.000000)
      augSpec3.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear)
      
      augSpec3.EnableScale(True)
      augSpec3.SetScaleParam(0.670000, 1.500000, 0.670000, 1.500000, True, 1.000000)
      
      AugmentationPreset3 = CAugmentationPreset()
      flaClassNum3 = List[int]()
      flaClassNum3.Add(3)
      AugmentationPreset3.SetClassNumbers(flaClassNum3)
      AugmentationPreset3.SetName("Class 3")
      AugmentationPreset3.SetAugmentationSpec(augSpec3)
      classifier.AddLearningAugmentationPreset(AugmentationPreset3)
      augSpec4 = CAugmentationSpec()
      
      augSpec4.EnableAugmentation(True)
      augSpec4.SetCommonActivationRate(1.000000)
      augSpec4.SetCommonIoUThreshold(0.000000)
      augSpec4.SetCommonInterpolationMethod(EInterpolationMethod.Bilinear)
      
      augSpec4.EnableQuarterRotation(True)
      augSpec4.SetQuarterRotationParam(True, True, True, True, 1.000000)
      
      AugmentationPreset4 = CAugmentationPreset()
      flaClassNum4 = List[int]()
      flaClassNum4.Add(4)
      flaClassNum4.Add(5)
      AugmentationPreset4.SetClassNumbers(flaClassNum4)
      AugmentationPreset4.SetName("Class 4,5")
      AugmentationPreset4.SetAugmentationSpec(augSpec4)
      classifier.AddLearningAugmentationPreset(AugmentationPreset4)
      '''
      classifier Learn 수행 코드...
      '''
      
  1. GUI에서 설정하는 법

    Individual Classes Augmentation

    Fig. 증강 Preset 설정

  2. Fit 모드 설정

    1. 이미지를 텐서로 변환할 때의 Fit 모드를 설정합니다.

    2. 총 4가지 모드를 지원합니다.

      1. Fit
        1. 모델 크기에 맞춥니다.
      2. ProportionalFit
        1. 원본 비유을 유지하여 모델 크기에 맞춥니다.
      3. Center_NoFit
        1. 중심을 기준으로 모델 크기로 자릅니다.
      4. LeftTop_NoFit
        1. 좌상단을 기준으로 모델 크기로 자릅니다.
    3. API

      • SetFitMode(EFitMode eFitMode = EFitMode_ProportionalFit)
    4. 예제 코드

      CClassifierDL classifierDL;
      
      classifierDL.SetFitMode(EFitMode_Fit);
      
      CClassifierDL classifierDL = new CClassifierDL();
      
      classifierDL.SetFitMode(CClassifierDL.EFitMode.Fit);
      
      classifierDL = CClassifierDL()
      
      classifierDL.SetFitMode(CClassifierDL.EFitMode.Fit)
      
5. GUI에서 설정하는 법
Fit Mode

Fig. Fit 모드 설정

  1. 이미지 전처리 설정
  2. 종료 조건 설정
  3. 자동 저장 조건 설정
  4. Class Equalization 설정
  5. Optimal Learning State Preservation 설정

2 추론 결과 정보 출력 방법 설정

1 개요

  1. 어떠한 추론 결과 항목들을 출력할지 설정합니다.
    1. 추론 결과 정보에는 Classifier에서는 Class Num, Class Name, Confidence Score가 있습니다.
    2. 모든 항목이 출력되는 것이 기본으로 설정되어 있습니다.
    3. 각 항목은 결과 Figure의 이름으로 설정되어 출력됩니다.

2 API

3 예제 코드

CClassifierDL classifierDL;
CFLImage fliInferenceImage;
CFLImage fliInferenceResultImage;

classifierDL.SetInferenceImage(fliInferenceImage);
classifierDL.SetInferenceResultImage(fliInferenceResultImage);
classifierDL.SetInferenceResultItemSettings(FLImaging::AI::CClassifierDL::EInferenceResultItemSettings_ClassNum_ClassName);
classifierDL.Execute();
CClassifierDL classifierDL = new CClassifierDL();
CFLImage fliInferenceImage = new CFLImage();
CFLImage fliInferenceResultImage = new CFLImage();

classifierDL.SetInferenceImage(ref fliInferenceImage);
classifierDL.SetInferenceResultImage(ref fliInferenceResultImage);
classifierDL.SetInferenceResultItemSettings(CClassifierDL.EInferenceResultItemSettings.ClassNum_ClassName);
classifierDL.Execute();
classifierDL = CClassifierDL()
fliInferenceImage = CFLImage()
fliInferenceResultImage = CFLImage()

classifierDL.SetInferenceImage(fliInferenceImage)
classifierDL.SetInferenceResultImage(fliInferenceResultImage)
classifierDL.SetInferenceResultItemSettings(CClassifierDL.EInferenceResultItemSettings.ClassNum_ClassName)
classifierDL.Execute()

4 GUI에서 설정하는 방법

Inference Result

Fig. 받고 싶은 추론 결과 정보들을 선택하는 Check Box

3 추론 배치 프로세싱 설정

5 결과 출력

1 모델 정보

1 개요

2 API

3 예제 코드

CClassifierDL classifierDL;
FLImaging::AI::CClassifierDL::EModel model;
FLImaging::AI::CClassifierDL::EModelVersion modelVersion;

model = classifierDL.GetModel();
modelVersion = classifier.GetModelVersion();
CClassifierDL classifierDL = new CClassifierDL();
CClassifierDL.EModel model;
CClassifierDL.EModelVersion modelVersion;

model = classifierDL.GetModel();
modelVersion = classifierDL.GetModelVersion();
classifierDL = CClassifierDL()

model = classifierDL.GetModel()
modelVersion = classifierDL.GetModelVersion()

4 GUI에서 확인하는 방법

아래 이미지와 같이 학습을 시작한 후 나오는 dialog 창의 model 항목을 확인하거나, 로드한 학습 정보 파일은 Parameter – Learn – Model/Model Version 항목에서 현재 사용하는 모델 정보를 확인할 수 있습니다.

Model Information

Fig. 학습 시 출력되는 Dialog 창에서 Model에 대한 정보가 출력되는 부분

2 학습 정보 출력

1 개요

2 API

3 예제 코드

CClassifierDL classifierDL;

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

classifierDL.Learn();

float f32LastAccuracy;
float f32LastF1Score;
float f32MaxAccuracy;
float f32MaxF1Score;
int32_t i32MaxAccEpoch;
int32_t i32MaxF1ScoreEpoch;

//마지막 accuracy 값
f32LastAccuracy = classifierDL.GetLearningResultLastAccuracy();
//마지막 F1 score 
f32LastF1Score = classifierDL.GetLearningResultLastF1Score();
//학습 진행하면서 나온 Maximum accuracy 값
f32MaxAccuracy = classifierDL.GetLearningResultMaximumAccuracy();
//학습 진행하면서 나온 Maximum F1 Score
f32MaxF1Score = classifierDL.GetLearningResultMaximumF1Score();
//Maximum accuracy가 나온 epoch
i32MaxAccEpoch = classifierDL.GetLearningResultMaximumAccuracyCumulativeEpoch();
//Maximum F1 Score가 나온 epoch
i32MaxF1ScoreEpoch = classifierDL.GetLearningResultMaximumF1ScoreCumulativeEpoch();

CFLArray<float> flaCostHistory;
CFLArray<float> flaValidationHistory;
CFLArray<float> flaF1ScoreHistory;
CFLArray<int32_t> flaValidationEpochHistory;

classifierDL.GetLearningResultAllHistory(flaCostHistory, flaValidationHistory, flaF1ScoreHistory, flaValidationEpochHistory);
CClassifierDL classifierDL = new CClassifierDL();

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

classifierDL.Learn();

float f32LastAccuracy;
float f32LastF1Score;
float f32MaxAccuracy;
float f32MaxF1Score;
int i32MaxAccEpoch;
int i32MaxF1ScoreEpoch;

//마지막 accuracy 값
f32LastAccuracy = classifierDL.GetLearningResultLastAccuracy();
//마지막 F1 score 
f32LastF1Score = classifierDL.GetLearningResultLastF1Score();
//학습 진행하면서 나온 Maximum accuracy 값
f32MaxAccuracy = classifierDL.GetLearningResultMaximumAccuracy();
//학습 진행하면서 나온 Maximum F1 Score
f32MaxF1Score = classifierDL.GetLearningResultMaximumF1Score();
//Maximum accuracy가 나온 epoch
i32MaxAccEpoch = classifierDL.GetLearningResultMaximumAccuracyCumulativeEpoch();
//Maximum F1 Score가 나온 epoch
i32MaxF1ScoreEpoch = classifierDL.GetLearningResultMaximumF1ScoreCumulativeEpoch();

List<float> listCostHistory = new List<float>();
List<float> listValidationHistory = new List<float>();
List<float> listF1ScoreHistory = new List<float>();
List<int> listValidationEpochHistory = new List<int>();

classifierDL.GetLearningResultAllHistory(ref listCostHistory, ref listValidationHistory, ref listF1ScoreHistory, ref listValidationEpochHistory);
classifierDL = CClassifierDL()

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

classifierDL.Learn()

# 마지막 accuracy 값
f32LastAccuracy = classifierDL.GetLearningResultLastAccuracy()
# 마지막 F1 score 
f32LastF1Score = classifierDL.GetLearningResultLastF1Score()
# 학습 진행하면서 나온 Maximum accuracy 값
f32MaxAccuracy = classifierDL.GetLearningResultMaximumAccuracy()
# 학습 진행하면서 나온 Maximum F1 Score
f32MaxF1Score = classifierDL.GetLearningResultMaximumF1Score()
# Maximum accuracy가 나온 epoch
i32MaxAccEpoch = classifierDL.GetLearningResultMaximumAccuracyCumulativeEpoch()
# Maximum F1 Score가 나온 epoch
i32MaxF1ScoreEpoch = classifierDL.GetLearningResultMaximumF1ScoreCumulativeEpoch()

listCostHistory = List[Single]()
listValidationHistory = List[Single]()
listF1ScoreHistory = List[Single]()
listValidationEpochHistory = List[int]()

classifierDL.GetLearningResultAllHistory(listCostHistory, listValidationHistory, listF1ScoreHistory, listValidationEpochHistory)

4 GUI에서 확인하는 방법

  1. 학습을 시작하면 나오는 Dialog의 Show info 버튼을 눌러 확장하여 아래와 같이 표시한 부분에서 관련된 데이터들을 확인할 수 있습니다.
Dialog Result

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


  1. property 창의 Learned Model Information의 Epoch과 Validation 항목의 표시된 부분에서 해당 함수와 관련된 데이터들을 확인할 수 있습니다.
Property Result

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


  1. All Histories의 경우 학습이 진행되면 프로그램 하단의 graph view에서 실시간으로 학습이 진행되면서 나온 cost 및 validation 등의 기록들을 확인할 수 있습니다.
Graph View Result

Fig. 학습 결과가 출력되는 Graph View

6 Learn/Inference 가이드

1 동작 순서

  1. 필수 옵션선택 옵션들을 설정합니다.
  2. 공통 설정

2 Inference 가이드

Inference Image Inference Result Image
No ROI Inference No ROI Inference Result
Fig. ROI 설정이 없는 경우 Inference 결과

Inference Image Inference Result Image
ROI Inference ROI Inference Result
Fig. ROI를 설정한 경우 Inference 결과