run method
override
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
final annotatedResponses = await annotate();
final scores = <double>[];
if (argResults?['look-for'] != null) {
for (var annotatedResponse in annotatedResponses.responses) {
annotatedResponse.localizedObjectAnnotations
.where((localizedObjectAnnotation) =>
localizedObjectAnnotation.name == argResults!['look-for'])
.toList()
.forEach((localizedObjectAnnotation) =>
scores.add(localizedObjectAnnotation.score));
}
} else {
for (var annotatedResponse in annotatedResponses.responses) {
scores.addAll(annotatedResponse.faceAnnotations
.map((faceAnnotation) => faceAnnotation.detectionConfidence)
.toList());
}
}
print(json.encode(scores));
}