- Newest
- Most votes
- Most comments
While Amazon Rekognition Face Liveness is designed to help verify that a user is physically present in front of a camera and detect spoof attacks, including those presented via images or videos, it's not infallible and may not detect all spoof attempts.
Spoof detection algorithms can vary in effectiveness depending on various factors such as the quality of the camera, lighting conditions, facial expressions, and the sophistication of the spoofing techniques used. Additionally, no spoof detection system is foolproof, and there will always be a possibility of false positives or false negatives.
If you're experiencing issues with the accuracy of the service, I would recommend reaching out to AWS support for further assistance. They may be able to provide guidance on optimizing the configuration or offer insights into potential improvements. Additionally, consider providing feedback to AWS about your experience, as they continuously strive to enhance their services based on user feedback and real-world usage scenarios.
Below I am pasting my code to let you know which methods I am using correctly
async function checkLiveness(job) {
try {
const { objectKey, bucketName , params} = job.data;
if (!objectKey) {
console.log('No video files found in the bucket.')
return
// throw new Error('No video files found in the bucket.');
}
const rekognitionParams = {
Video: {
S3Object: {
Bucket: bucketName,
Name: objectKey
}
},
FaceAttributes: 'ALL',
JobTag: 'LivenessCheck'
};
// Start face detection job
const startResponse = await rekognition.startFaceDetection(rekognitionParams).promise();
const jobId = startResponse.JobId;
let jobStatus;
do {
await new Promise(resolve => setTimeout(resolve, 5000));
const statusResponse = await rekognition.getFaceDetection({ JobId: jobId }).promise();
jobStatus = statusResponse.JobStatus;
} while (jobStatus !== 'SUCCEEDED' && jobStatus !== 'FAILED');
// Retrieve the face detection results
const faceDetails = await rekognition.getFaceDetection({ JobId: jobId }).promise();
const livenessScore = faceDetails.Faces.map(item=>item.Face);
const livenessData = [];
asyncLoop(livenessScore, (liveObj, next)=>{
livenessData.push({
KYC_id: params.kyc_id,
bounding_box: liveObj.BoundingBox,
age_range: liveObj.AgeRange,
smile: liveObj.Smile,
eyeglasses: liveObj.Eyeglasses,
sunglasses: liveObj.Sunglasses,
gender: liveObj.Gender,
beard: liveObj.Beard,
mustache: liveObj.Mustache,
eyesopen: liveObj.EyesOpen,
mouthopen: liveObj.MouthOpen,
emotions: liveObj.Emotions,
landmarks: liveObj.Landmarks,
pose: liveObj.Pose,
quality: liveObj.Quality,
confidence: liveObj.Confidence
});
next();
}, async (err)=> {
if (err) {
console.log('error inserting liveness records', err);
return
}
await LivenessManager.createLivenessRecordBulk(livenessData);
console.log('Livesness record successfully inserted')
await nameVerification(params.kyc_id)
})
} catch (error) {
console.log(`error while permofing liveness check ${error}`)
// throw new Error('Error performing liveness check: ' + error.message);
}
};
Based on the new question you asked " Please provide me with name of Method or API which I can use for spoof detection" you can use the "DetectFaces" API provided by Amazon Rekognition You can read more about it here in thie AWS Reference document :- https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectFaces.html . This API detects faces in an image or video and analyzes facial attributes such as whether the face is real or a spoof.
Here's how you can modify your code to use the "DetectFaces" API for spoof detection:
async function checkLiveness(job) {
try {
const { objectKey, bucketName, params } = job.data;
if (!objectKey) {
console.log('No video files found in the bucket.');
return;
}
const rekognitionParams = {
Image: {
S3Object: {
Bucket: bucketName,
Name: objectKey
}
},
Attributes: ['ALL']
};
// Detect faces in the image
const detectionResponse = await rekognition.detectFaces(rekognitionParams).promise();
const faceDetails = detectionResponse.FaceDetails;
// Check if any detected face is real or a spoof
const livenessData = faceDetails.map(face => ({
KYC_id: params.kyc_id,
bounding_box: face.BoundingBox,
age_range: face.AgeRange,
smile: face.Smile,
eyeglasses: face.Eyeglasses,
sunglasses: face.Sunglasses,
gender: face.Gender,
beard: face.Beard,
mustache: face.Mustache,
eyesopen: face.EyesOpen,
mouthopen: face.MouthOpen,
emotions: face.Emotions,
landmarks: face.Landmarks,
pose: face.Pose,
quality: face.Quality,
confidence: face.Confidence
}));
// Insert liveness records into the database
await LivenessManager.createLivenessRecordBulk(livenessData);
console.log('Liveness records successfully inserted');
// Perform name verification
await nameVerification(params.kyc_id);
} catch (error) {
console.log(`Error performing liveness check: ${error}`);
}
};
Please note that the detection of spoof faces may not be perfect and may require additional analysis or validation depending on your specific use case
Relevant content
- asked 2 months ago
- asked 2 months ago
- asked a year ago
- asked 10 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Hey Adeleke, Thanks for your Response. I am looking for the API's which can detect the Spoof Videos. Please provide me with name of Method or API which I can use for spoof detection.