in source/analysis-monitor/lib/index.js [477:511]
async startImageAnalysis(asset, options) {
if (asset.type !== 'image') {
return undefined;
}
/* no video analysis options are enabled */
if (!(options.label || options.celeb || options.face
|| options.faceMatch || options.text || options.moderation)) {
return undefined;
}
const proxy = (asset.proxies || []).reduce((acc, cur) =>
((acc && acc.fileSize >= cur.fileSize) ? acc : cur), undefined);
if (!proxy || !proxy.key) {
return undefined;
}
/* make sure image file exists */
try {
await CommonUtils.headObject(Environment.Proxy.Bucket, proxy.key);
} catch (e) {
return undefined;
}
return this.startExecution(Environment.StateMachines.ImageAnalysis, {
uuid: this.stateData.uuid,
input: {
image: {
key: proxy.key,
baseDir: this.makeAnalysisOutputPath(asset.key),
},
aiOptions: options,
},
});
}