public static boolean isEmpty(Collection collection) { return !isNotEmpty(collection); }
@NotNull private List<IdentificationSet> buildIdentificationList(@NotNull String personGroupId, @NotNull List<Face> faces, @NotNull List<Identification> identificationList) { List<IdentificationSet> identificationSetList = new ArrayList<>(); for (Identification identification : identificationList) { Optional<Face> first = faces.stream().filter(x -> x.faceId.equals(identification.faceId)).findFirst(); identificationSetList.add(new IdentificationSet(first.get(), identification, Utils.isNotEmpty(identification.candidates) ? personBuilder.getPerson(personGroupId, identification.candidates.get(0).personId).withResult() : null)); System.out.println(identification); } return identificationSetList; }
@NotNull private IdentificationSet identifyPersonInGroup(@NotNull String personGroupId, @NotNull Face singleFace) { Identification identification = Utils.elementAt(faceTaskBuilder.identifyFaces(Collections.singletonList(singleFace.faceId), personGroupId, 1).withResult(), 0); if (identification != null && Utils.isNotEmpty(identification.candidates)) return new IdentificationSet(singleFace, identification, personBuilder.getPerson(personGroupId, identification.candidates.get(0).personId).withResult()); return new IdentificationSet(singleFace, identification); }
private void buildContext(Object image) { workingContext.setPath("vision/v1.0/analyze") .httpMethod(HttpMethod.POST); if (Utils.isNotEmpty(visualFeatures)) workingContext().addQueryParameter("visualFeatures", StringUtils.join(visualFeatures, ',')); if (Utils.isNotEmpty(visualFeatures)) workingContext().addQueryParameter("details", StringUtils.join(domainSpecificDetails, ',')); if (image instanceof String) workingContext.addPayload("url", String.valueOf(image)); if (image instanceof InputStream) workingContext.addPayload(IMAGE_INPUT_STREAM_KEY, image); }
public static void validateExclusive(List collection, String str, ParameterValidationException toThrow) { if ((Utils.isEmpty(collection) && Utils.isBlank(str)) || (Utils.isNotEmpty(collection) && Utils.isNotBlank(str))) throw toThrow; } }
private void buildContext(Object image) { workingContext.setPath("vision/v1.0/models/${models}/analyze") .httpMethod(HttpMethod.POST); if (Utils.isNotEmpty(models)) workingContext().addPathVariable("models", StringUtils.join(models, ',')); if (image instanceof String) workingContext.addPayload("url", String.valueOf(image)); if (image instanceof InputStream) workingContext.addPayload(IMAGE_INPUT_STREAM_KEY, image); }
private void buildContext() { workingContext.setPath("face/v1.0/findsimilars") .httpMethod(HttpMethod.POST).addPayload("faceId", faceId).addPayload("maxNumOfCandidatesReturned", maxNumOfCandidates); if (Utils.isNotEmpty(faceIds)) workingContext().addPayload("faceIds", faceIds); else workingContext().addPayload("faceListId", faceListId); }