From 897fb2a8003084c0461d69c4c113ff67fa0f84ae Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Wed, 28 Jun 2017 15:54:52 -0700 Subject: [PATCH] Remove entire video from faces Change-Id: I521c35bd3ada34c45e84f39fc99041d19fbc41f5 --- video/analyze.js | 21 +++++---------------- video/quickstart.js | 21 +++++---------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/video/analyze.js b/video/analyze.js index a6f1d7b77c..5ed2312cbd 100644 --- a/video/analyze.js +++ b/video/analyze.js @@ -44,22 +44,11 @@ function analyzeFaces (gcsUri) { console.log('Faces:'); faces.forEach((face, faceIdx) => { console.log('Thumbnail size:', face.thumbnail.length); - - const isEntireVideo = face.segments.some((segment) => - segment.startTimeOffset.toNumber() === -1 && - segment.endTimeOffset.toNumber() === -1 - ); - - if (isEntireVideo) { - console.log(`Face #${faceIdx}`); - console.log(`\tEntire video`); - } else { - face.segments.forEach((segment, segmentIdx) => { - console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`); - console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`); - console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`); - }); - } + face.segments.forEach((segment, segmentIdx) => { + console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`); + console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`); + console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`); + }); }); }) .catch((err) => { diff --git a/video/quickstart.js b/video/quickstart.js index 8a1bf3290a..3aeec4334c 100644 --- a/video/quickstart.js +++ b/video/quickstart.js @@ -48,22 +48,11 @@ video.annotateVideo(request) const faces = annotations.faceAnnotations; faces.forEach((face, faceIdx) => { console.log('Thumbnail size:', face.thumbnail.length); - - const isEntireVideo = face.segments.some((segment) => - segment.startTimeOffset.toNumber() === -1 && - segment.endTimeOffset.toNumber() === -1 - ); - - if (isEntireVideo) { - console.log(`Face #${faceIdx}`); - console.log(`\tEntire video`); - } else { - face.segments.forEach((segment, segmentIdx) => { - console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`); - console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`); - console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`); - }); - } + face.segments.forEach((segment, segmentIdx) => { + console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`); + console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`); + console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`); + }); }); // Gets labels for video from its annotations