feat/training_260202 #128
@@ -65,16 +65,48 @@ public class ModelTestMetricsJobRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public void insertModelMetricsTest(List<Object[]> batchArgs) {
|
||||
String sql =
|
||||
"""
|
||||
insert into tb_model_metrics_test
|
||||
(model_id, model, tp, fp, fn, precisions, recall, f1_score, accuracy, iou,
|
||||
detection_count, gt_count
|
||||
)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
// AS-IS
|
||||
// String sql =
|
||||
// """
|
||||
// insert into tb_model_metrics_test
|
||||
// (model_id, model, tp, fp, fn, precisions, recall, f1_score, accuracy, iou,
|
||||
// detection_count, gt_count
|
||||
// )
|
||||
// values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
// """;
|
||||
//
|
||||
// jdbcTemplate.batchUpdate(sql, batchArgs);
|
||||
|
||||
jdbcTemplate.batchUpdate(sql, batchArgs);
|
||||
// TO-BE: modelId, model(best_fscore_10) 같은 데이터가 있으면 update, 없으면 insert
|
||||
String updateSql =
|
||||
"""
|
||||
UPDATE tb_model_metrics_test
|
||||
SET tp=?, fp=?, fn=?, precisions=?, recall=?, f1_score=?, accuracy=?, iou=?,
|
||||
detection_count=?, gt_count=?
|
||||
WHERE model_id=? AND model=?
|
||||
""";
|
||||
|
||||
String insertSql =
|
||||
"""
|
||||
INSERT INTO tb_model_metrics_test
|
||||
(model_id, model, tp, fp, fn, precisions, recall, f1_score, accuracy, iou,
|
||||
detection_count, gt_count)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
|
||||
// row 단위 처리 (batch 안에서 upsert)
|
||||
for (Object[] row : batchArgs) {
|
||||
// row 순서: (model_id, model, tp, fp, fn, precisions, recall, f1_score, accuracy, iou,
|
||||
// detection_count, gt_count)
|
||||
int updated =
|
||||
jdbcTemplate.update(
|
||||
updateSql, row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10],
|
||||
row[11], row[0], row[1]);
|
||||
|
||||
if (updated == 0) {
|
||||
jdbcTemplate.update(insertSql, row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,11 +131,9 @@ public class ModelTestMetricsJobRepositoryImpl extends QuerydslRepositorySupport
|
||||
.on(
|
||||
modelMetricsTestEntity.model.eq(modelMetricsTrainEntity.model),
|
||||
modelMasterEntity.bestEpoch.eq(modelMetricsTrainEntity.epoch))
|
||||
.where(
|
||||
modelMetricsTestEntity.model.id.eq(modelId),
|
||||
modelMetricsTestEntity.model1.eq(
|
||||
"best_changed_fscore_epoch_" + modelMasterEntity.bestEpoch))
|
||||
.fetchOne();
|
||||
.where(modelMetricsTestEntity.model.id.eq(modelId))
|
||||
.orderBy(modelMetricsTestEntity.createdDttm.desc())
|
||||
.fetchFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,10 +26,9 @@ public class TmpDatasetService {
|
||||
* @param uid 임시폴더 uuid
|
||||
* @param type train, val, test
|
||||
* @param links tif pull path
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public String buildTmpDatasetHardlink(String uid, String type, List<ModelTrainLinkDto> links)
|
||||
public void buildTmpDatasetHardlink(String uid, String type, List<ModelTrainLinkDto> links)
|
||||
throws IOException {
|
||||
|
||||
if (links == null || links.isEmpty()) {
|
||||
@@ -71,7 +70,6 @@ public class TmpDatasetService {
|
||||
}
|
||||
|
||||
log.info("tmp dataset created: {}, hardlinksMade={}", tmp, hardlinksMade);
|
||||
return uid;
|
||||
}
|
||||
|
||||
private long link(Path tmp, String type, String part, String fullPath) throws IOException {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class TrainJobWorker {
|
||||
evalReq.setTimeoutSeconds(null);
|
||||
evalReq.setDatasetFolder(datasetFolder);
|
||||
evalReq.setOutputFolder(outputFolder);
|
||||
|
||||
log.info("[JOB] selected test epoch={}", epoch);
|
||||
result = dockerTrainService.runEvalSync(evalReq, containerName);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user