데이터셋 등록 추가
This commit is contained in:
@@ -1,336 +0,0 @@
|
||||
package com.kamco.cd.training.model.dto;
|
||||
|
||||
import com.kamco.cd.training.common.enums.TrainStatusType;
|
||||
import com.kamco.cd.training.common.enums.TrainType;
|
||||
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public class ModelTrainDto {
|
||||
@Schema(name = "모델학습관리 목록", description = "모델학습관리 목록")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class Basic {
|
||||
|
||||
private Long id;
|
||||
private UUID uuid;
|
||||
private String modelVer;
|
||||
@JsonFormatDttm private ZonedDateTime startDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step1StrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step1EndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step2StrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step2EndDttm;
|
||||
private String step1Status;
|
||||
private String step2Status;
|
||||
private String statusCd;
|
||||
private String trainType;
|
||||
|
||||
public String getStatusName() {
|
||||
if (this.statusCd == null || this.statusCd.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.statusCd).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.statusCd; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getStep1StatusName() {
|
||||
if (this.step1Status == null || this.step1Status.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.step1Status).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.step1Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getStep2StatusNAme() {
|
||||
if (this.step2Status == null || this.step2Status.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.step2Status).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.step2Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getTrainTypeName() {
|
||||
if (this.trainType == null || this.trainType.isBlank()) return null;
|
||||
try {
|
||||
return TrainType.valueOf(this.trainType).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.trainType; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
private String formatDuration(ZonedDateTime start, ZonedDateTime end) {
|
||||
if (start == null || end == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long totalSeconds = Math.abs(Duration.between(start, end).getSeconds());
|
||||
|
||||
long hours = totalSeconds / 3600;
|
||||
long minutes = (totalSeconds % 3600) / 60;
|
||||
long seconds = totalSeconds % 60;
|
||||
|
||||
return String.format("%d시간 %d분 %d초", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public String getStep1Duration() {
|
||||
return formatDuration(this.step1StrtDttm, this.step1EndDttm);
|
||||
}
|
||||
|
||||
public String getStep2Duration() {
|
||||
return formatDuration(this.step2StrtDttm, this.step2EndDttm);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "searchReq", description = "모델학습 관리 목록조회 파라미터")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SearchReq {
|
||||
|
||||
private String status;
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
private int size = 20;
|
||||
|
||||
public Pageable toPageable() {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "addReq", description = "모델학습 관리 등록 파라미터")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AddReq {
|
||||
HyperParamDto hyperParam;
|
||||
TrainingDataConfigDto trainingDataConfig;
|
||||
EtcConfig etcConfig;
|
||||
}
|
||||
|
||||
/** 학습실행설정 하이퍼파라미터 설정 */
|
||||
@Schema(name = "하이퍼파라미터 설정", description = "학습실행설정 > 하이퍼파라미터 설정")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class HyperParamDto {
|
||||
|
||||
@NotNull
|
||||
@Schema(
|
||||
description = "OPTIMIZED(최적화 파라미터),EXISTING(기존 파라미터),NEW(신규 파라미터)",
|
||||
example = "EXISTING")
|
||||
private String hyperParamType;
|
||||
|
||||
@Schema(description = "기존 파라미터 uuid", example = "57fc9170-64c1-4128-aa7b-0657f08d6d10")
|
||||
private String hyperUuid;
|
||||
|
||||
// -------------------------
|
||||
// Important
|
||||
// -------------------------
|
||||
@Schema(description = "백본 네트워크", example = "large")
|
||||
private String backbone; // backbone
|
||||
|
||||
@Schema(description = "입력 이미지 크기(H,W)", example = "512,512")
|
||||
private String inputSize; // input_size
|
||||
|
||||
@Schema(description = "크롭 크기(H,W 또는 단일값)", example = "256,256")
|
||||
private String cropSize; // crop_size
|
||||
|
||||
@Schema(description = "배치 크기(Per GPU)", example = "16")
|
||||
private Integer batchSize; // batch_size
|
||||
|
||||
// -------------------------
|
||||
// Data
|
||||
// -------------------------
|
||||
@Schema(description = "Train dataloader workers", example = "16")
|
||||
private Integer trainNumWorkers; // train_num_workers
|
||||
|
||||
@Schema(description = "Val dataloader workers", example = "8")
|
||||
private Integer valNumWorkers; // val_num_workers
|
||||
|
||||
@Schema(description = "Test dataloader workers", example = "8")
|
||||
private Integer testNumWorkers; // test_num_workers
|
||||
|
||||
@Schema(description = "Train shuffle 여부", example = "true")
|
||||
private Boolean trainShuffle; // train_shuffle
|
||||
|
||||
@Schema(description = "Train persistent workers 여부", example = "true")
|
||||
private Boolean trainPersistent; // train_persistent
|
||||
|
||||
@Schema(description = "Val persistent workers 여부", example = "true")
|
||||
private Boolean valPersistent; // val_persistent
|
||||
|
||||
// -------------------------
|
||||
// Model Architecture
|
||||
// -------------------------
|
||||
@Schema(description = "Drop Path 비율", example = "0.3")
|
||||
private Double dropPathRate; // drop_path_rate
|
||||
|
||||
@Schema(description = "Freeze 단계(-1:None)", example = "-1")
|
||||
private Integer frozenStages; // frozen_stages
|
||||
|
||||
@Schema(description = "Neck 결합 정책", example = "abs_diff")
|
||||
private String neckPolicy; // neck_policy
|
||||
|
||||
@Schema(description = "디코더 채널 구성", example = "512,256,128,64")
|
||||
private String decoderChannels; // decoder_channels
|
||||
|
||||
@Schema(description = "클래스별 가중치", example = "1,10")
|
||||
private String classWeight; // class_weight
|
||||
|
||||
// -------------------------
|
||||
// Loss & Optimization
|
||||
// -------------------------
|
||||
@Schema(description = "학습률", example = "0.00006")
|
||||
private Double learningRate; // learning_rate
|
||||
|
||||
@Schema(description = "Weight Decay", example = "0.05")
|
||||
private Double weightDecay; // weight_decay
|
||||
|
||||
@Schema(description = "Layer Decay Rate", example = "0.9")
|
||||
private Double layerDecayRate; // layer_decay_rate
|
||||
|
||||
@Schema(description = "DDP unused params 탐색 여부", example = "true")
|
||||
private Boolean ddpFindUnusedParams; // ddp_find_unused_params
|
||||
|
||||
@Schema(description = "Loss 계산 제외 인덱스", example = "255")
|
||||
private Integer ignoreIndex; // ignore_index
|
||||
|
||||
@Schema(description = "레이어 깊이", example = "24")
|
||||
private Integer numLayers; // num_layers
|
||||
|
||||
// -------------------------
|
||||
// Evaluation
|
||||
// -------------------------
|
||||
@Schema(description = "평가 지표 목록", example = "mFscore,mIoU")
|
||||
private String metrics; // metrics
|
||||
|
||||
@Schema(description = "Best 모델 선정 기준 지표", example = "changed_fscore")
|
||||
private String saveBest; // save_best
|
||||
|
||||
@Schema(description = "Best 모델 선정 규칙", example = "less")
|
||||
private String saveBestRule; // save_best_rule
|
||||
|
||||
@Schema(description = "검증 수행 주기(Epoch)", example = "10")
|
||||
private Integer valInterval; // val_interval
|
||||
|
||||
@Schema(description = "로그 기록 주기(Iteration)", example = "400")
|
||||
private Integer logInterval; // log_interval
|
||||
|
||||
@Schema(description = "시각화 저장 주기(Epoch)", example = "1")
|
||||
private Integer visInterval; // vis_interval
|
||||
|
||||
// -------------------------
|
||||
// Augmentation
|
||||
// -------------------------
|
||||
@Schema(description = "회전 적용 확률", example = "0.5")
|
||||
private Double rotProb; // rot_prob
|
||||
|
||||
@Schema(description = "회전 각도 범위(Min,Max)", example = "-20,20")
|
||||
private String rotDegree; // rot_degree
|
||||
|
||||
@Schema(description = "반전 적용 확률", example = "0.5")
|
||||
private Double flipProb; // flip_prob
|
||||
|
||||
@Schema(description = "채널 교환 확률", example = "0.5")
|
||||
private Double exchangeProb; // exchange_prob
|
||||
|
||||
@Schema(description = "밝기 변화량", example = "10")
|
||||
private Integer brightnessDelta; // brightness_delta
|
||||
|
||||
@Schema(description = "대비 범위(Min,Max)", example = "0.8,1.2")
|
||||
private String contrastRange; // contrast_range
|
||||
|
||||
@Schema(description = "채도 범위(Min,Max)", example = "0.8,1.2")
|
||||
private String saturationRange; // saturation_range
|
||||
|
||||
@Schema(description = "색조 변화량", example = "10")
|
||||
private Integer hueDelta; // hue_delta
|
||||
|
||||
// -------------------------
|
||||
// Hardware
|
||||
// -------------------------
|
||||
@Schema(description = "사용 GPU 개수", example = "4")
|
||||
private Integer gpuCnt; // gpu_cnt
|
||||
|
||||
@Schema(description = "사용 GPU ID 목록", example = "0,1,2,3")
|
||||
private String gpuIds; // gpu_ids
|
||||
|
||||
@Schema(description = "분산학습 마스터 포트", example = "1122")
|
||||
private Integer masterPort; // master_port
|
||||
|
||||
// -------------------------
|
||||
// Memo
|
||||
// -------------------------
|
||||
@Schema(description = "메모", example = "하이퍼파라미터 신규등록")
|
||||
private String memo; // memo
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class TrainingDataConfigDto {
|
||||
Summary summary;
|
||||
List<Dataset> datasetList;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Summary {
|
||||
@Schema(description = "건물", example = "0")
|
||||
private Long buildingCnt;
|
||||
|
||||
@Schema(description = "컨테이너", example = "0")
|
||||
private Long containerCnt;
|
||||
|
||||
@Schema(description = "폐기물", example = "0")
|
||||
private Long wasteCnt;
|
||||
|
||||
@Schema(
|
||||
description = "도로, 비닐하우스, 밭, 과수원, 초지, 숲, 물, 모재/자갈, 토분(무덤), 일반토지, 태양광, 기타",
|
||||
example = "0")
|
||||
private Long LandCoverCnt;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Dataset {
|
||||
@Schema(description = "데이터셋 uuid")
|
||||
private UUID uuid;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class EtcConfig {
|
||||
@Schema(description = "에폭 횟수", example = "0")
|
||||
private Long epochCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Training", example = "0")
|
||||
private Integer trainingCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Validation", example = "0")
|
||||
private Integer validationCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Test", example = "0")
|
||||
private Integer testCnt;
|
||||
|
||||
@Schema(description = "메모", example = "메모 입니다.")
|
||||
private String memo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.kamco.cd.training.model.dto;
|
||||
|
||||
import com.kamco.cd.training.common.dto.HyperParam;
|
||||
import com.kamco.cd.training.common.enums.TrainStatusType;
|
||||
import com.kamco.cd.training.common.enums.TrainType;
|
||||
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public class ModelTrainMngDto {
|
||||
@Schema(name = "모델학습관리 목록", description = "모델학습관리 목록")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class Basic {
|
||||
|
||||
private Long id;
|
||||
private UUID uuid;
|
||||
private String modelVer;
|
||||
@JsonFormatDttm private ZonedDateTime startDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step1StrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step1EndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step2StrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime step2EndDttm;
|
||||
private String step1Status;
|
||||
private String step2Status;
|
||||
private String statusCd;
|
||||
private String trainType;
|
||||
|
||||
public String getStatusName() {
|
||||
if (this.statusCd == null || this.statusCd.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.statusCd).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.statusCd; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getStep1StatusName() {
|
||||
if (this.step1Status == null || this.step1Status.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.step1Status).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.step1Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getStep2StatusNAme() {
|
||||
if (this.step2Status == null || this.step2Status.isBlank()) return null;
|
||||
try {
|
||||
return TrainStatusType.valueOf(this.step2Status).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.step2Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
public String getTrainTypeName() {
|
||||
if (this.trainType == null || this.trainType.isBlank()) return null;
|
||||
try {
|
||||
return TrainType.valueOf(this.trainType).getText(); // 또는 getName()
|
||||
} catch (IllegalArgumentException e) {
|
||||
return this.trainType; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||
}
|
||||
}
|
||||
|
||||
private String formatDuration(ZonedDateTime start, ZonedDateTime end) {
|
||||
if (start == null || end == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long totalSeconds = Math.abs(Duration.between(start, end).getSeconds());
|
||||
|
||||
long hours = totalSeconds / 3600;
|
||||
long minutes = (totalSeconds % 3600) / 60;
|
||||
long seconds = totalSeconds % 60;
|
||||
|
||||
return String.format("%d시간 %d분 %d초", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public String getStep1Duration() {
|
||||
return formatDuration(this.step1StrtDttm, this.step1EndDttm);
|
||||
}
|
||||
|
||||
public String getStep2Duration() {
|
||||
return formatDuration(this.step2StrtDttm, this.step2EndDttm);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "searchReq", description = "모델학습 관리 목록조회 파라미터")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SearchReq {
|
||||
|
||||
private String status;
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
private int size = 20;
|
||||
|
||||
public Pageable toPageable() {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "addReq", description = "모델학습 관리 등록 파라미터")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AddReq {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "모델 종류 M1, M2, M3", example = "M1")
|
||||
private String modelNo;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "모델학습 실행 여부", example = "false")
|
||||
private Boolean isStart;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "학습타입 GENERAL(일반), TRANSFER(전이)", example = "GENERAL")
|
||||
private String trainType;
|
||||
|
||||
@NotNull
|
||||
@Schema(
|
||||
description = "하이퍼 파라미터 선택 타입 OPTIMIZED(최적화 파라미터),EXISTING(기존 파라미터),NEW(신규 파라미터)",
|
||||
example = "EXISTING")
|
||||
private String hyperParamType;
|
||||
|
||||
@Schema(description = "하이퍼파라미터 uuid", example = "57fc9170-64c1-4128-aa7b-0657f08d6d10")
|
||||
private UUID hyperUuid;
|
||||
|
||||
HyperParam hyperParam;
|
||||
TrainingDataset trainingDataset;
|
||||
ModelConfig modelConfig;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class TrainingDataset {
|
||||
Summary summary;
|
||||
List<Long> datasetList;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Summary {
|
||||
@Schema(description = "건물", example = "0")
|
||||
private Long buildingCnt;
|
||||
|
||||
@Schema(description = "컨테이너", example = "0")
|
||||
private Long containerCnt;
|
||||
|
||||
@Schema(description = "폐기물", example = "0")
|
||||
private Long wasteCnt;
|
||||
|
||||
@Schema(
|
||||
description = "도로, 비닐하우스, 밭, 과수원, 초지, 숲, 물, 모재/자갈, 토분(무덤), 일반토지, 태양광, 기타",
|
||||
example = "0")
|
||||
private Long LandCoverCnt;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ModelConfig {
|
||||
@Schema(description = "에폭 횟수", example = "0")
|
||||
private Integer epochCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Training", example = "0")
|
||||
private Float trainingCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Validation", example = "0")
|
||||
private Float validationCnt;
|
||||
|
||||
@Schema(description = "학습데이터셋 비율 Test", example = "0")
|
||||
private Float testCnt;
|
||||
|
||||
@Schema(description = "메모", example = "메모 입니다.")
|
||||
private String memo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user