Исключение: невозможно загрузить конфигурацию из EnvironmentVariableCsmConfigurationProvider - PullRequest
0 голосов
/ 17 января 2020

com.amazon aws .monitoring. ProfileCsmConfigurationProvider@dbf57b3: Невозможно загрузить файл конфигурации 16: 44: 37.586 [main] DEBUG com.amazon aws .regions.InstanceMetadataRegionProvider - Игнорирование сбоя при получении региона: Невозможно обратитесь в службу метаданных EC2. Исключение в потоке "main" com.amazon aws .SdkClientException: Невозможно найти регион через цепочку поставщиков региона. Должен предоставить явный регион в среде компоновщика или установки для предоставления региона

publi c class FaceCompare {

public static void main(String[] args) throws Exception {

    Float similarityThreshold = 70F;
    String sourceImage = "E://AngularWorkspace//ubi//ubiloanorigination07-01-2020 Nitesh//ubiloanorigination07-01-2020//ubiloanorigination1//src//assets//images//logo.png";
    String targetImage = "E://AngularWorkspace//ubi//ubiloanorigination07-01-2020 Nitesh//ubiloanorigination07-01-2020//ubiloanorigination1//src//assets//images//subk.png";
    ByteBuffer sourceImageBytes = null;
    ByteBuffer targetImageBytes = null;

    AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();

    try (InputStream inputStream = new FileInputStream(new File(sourceImage))) {
        sourceImageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
    } catch (Exception e) {
        System.out.println("Failed to load source image " + sourceImage);
        System.exit(1);
    }
    try (InputStream inputStream = new FileInputStream(new File(targetImage))) {
        targetImageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
    } catch (Exception e) {
        System.out.println("Failed to load target images: " + targetImage);
        System.exit(1);
    }

    Image source = new Image().withBytes(sourceImageBytes);
    Image target = new Image().withBytes(targetImageBytes);
    CompareFacesRequest request = new CompareFacesRequest().withSourceImage(source).withTargetImage(target)
            .withSimilarityThreshold(similarityThreshold);

    CompareFacesResult compareFacesResult = rekognitionClient.compareFaces(request);

    List<CompareFacesMatch> faceDetails = compareFacesResult.getFaceMatches();
    for (CompareFacesMatch match : faceDetails) {
        ComparedFace face = match.getFace();
        BoundingBox position = face.getBoundingBox();
        System.out.println("Face at " + position.getLeft().toString() + " " + position.getTop() + " matches with "
                + match.getSimilarity().toString() + "% confidence.");
        }
    List<ComparedFace> uncompared = compareFacesResult.getUnmatchedFaces();

    System.out.println("There was " + uncompared.size() + " face(s) that did not match");
}

}

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...