Commit 770ee300 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Fix LOGGER and getting landmarks

parent 5fce10fa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class DistanceTaskServiceImpl implements DistanceTaskService {
    private Map<Landmark, Double> getLandmarkRadii(DistanceTaskDto dto, HumanFace secondaryFace) {
        return dto.getFeaturePointSizes().stream()
                .collect(Collectors.toMap(
                        f -> secondaryFace.getAllLandmarks().stream()
                        f -> secondaryFace.getLandmarks().getAllLandmarks().stream()
                                .filter(fp -> fp.getName().equals(f.getName()))
                                .findAny().orElse(null),
                        DistanceTaskDto.FeaturePointSize::getSize));
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class RegistrationTaskServiceImpl implements RegistrationTaskService {
        return HumanFaceDto.builder()
                .id(secondaryFace.getId())
                .geometry(new HumanFaceGeometryDto(secondaryFace, true))
                .featurePoints(secondaryFace.getHumanFace().hasLandmarks() ?
                .featurePoints(secondaryFace.getHumanFace().getLandmarks().hasLandmarks() ?
                        new HumanFaceFeaturePointsDto(secondaryFace) : null)
                .symmetryPlane(secondaryFace.getHumanFace().hasSymmetryPlane() ?
                        new HumanFaceSymmetryPlaneDto(secondaryFace) : null)
+7 −4
Original line number Diff line number Diff line
package cz.fidentis.web.batchprocessing.registration;

import cz.fidentis.analyst.Logger;
import cz.fidentis.analyst.data.face.HumanFace;
import cz.fidentis.analyst.data.face.HumanFaceFactory;
import cz.fidentis.analyst.data.mesh.MeshIO;
@@ -32,6 +31,8 @@ import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.SerializationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -53,6 +54,8 @@ import java.util.concurrent.CompletionException;
@Slf4j
public class BatchRegistrationServiceImpl extends BatchBaseService implements BatchRegistrationService {

    private static final Logger LOGGER = LoggerFactory.getLogger(BatchRegistrationServiceImpl.class);

    @PersistenceContext
    private EntityManager em;

@@ -124,7 +127,7 @@ public class BatchRegistrationServiceImpl extends BatchBaseService implements Ba
            double newPSM = procrustesSurfaceMetric(selectedFace, newAvgFace);
            double psmDiff = Math.abs(prevPSM - newPSM);

            Logger.print("Iter. " + iter + " (PSM, |diff|): " + newPSM + ", " + psmDiff);
            LOGGER.info("Iter. " + iter + " (PSM, |diff|): " + newPSM + ", " + psmDiff);

            if (psmDiff < dto.getAveragingTaskDto().getStabilizationThreshold()) {
                break;
@@ -177,7 +180,7 @@ public class BatchRegistrationServiceImpl extends BatchBaseService implements Ba
        try {
            return doInBackground(dto).join();
        } catch (CompletionException | IOException ex) {
            Logger.print(ex.getCause().toString());
            LOGGER.error(ex.getCause().toString());
            return new RegistrationResultDto(null, false);
        }
    }
@@ -244,7 +247,7 @@ public class BatchRegistrationServiceImpl extends BatchBaseService implements Ba
        try {
            MeshIO.exportMeshModel(newAvgFace.getMeshModel(), tempFile);
        } catch (IOException ex) {
            Logger.print(ex.toString());
            LOGGER.error(ex.toString());
        }

        return newAvgFace;
+2 −2
Original line number Diff line number Diff line
@@ -51,8 +51,8 @@ public class TaskFaceInfo implements Serializable {
        this.previewPhotoData = faceInfo.getPreviewPhotoData();
        this.numberOfVertices = faceInfo.getNumberOfVertices();
        this.numberOfFacets = faceInfo.getNumberOfFacets();
        this.featurePointsNames = face.hasLandmarks()
                ? face.getAllLandmarks().stream().map(f -> f.getName()).toList()
        this.featurePointsNames = face.getLandmarks().hasLandmarks()
                ? face.getLandmarks().getAllLandmarks().stream().map(f -> f.getName()).toList()
                : null;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class HumanFaceDto {
        this.id = humanFaceEntity.getId();
        this.isPrimaryFace = humanFaceEntity.getIsPrimaryFace();
        this.isAverageFace = humanFaceEntity.getIsAverageFace();
        this.hasFeaturePoints = humanFaceEntity.getHumanFace().hasLandmarks();
        this.hasFeaturePoints = humanFaceEntity.getHumanFace().getLandmarks().hasLandmarks();
        this.hasSymmetryPlane = humanFaceEntity.getHumanFace().hasSymmetryPlane();
        this.info = humanFaceEntity.getHelperHumanFace().getTaskFaceInfo();

Loading