Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Results Across Different Operating Systems and Browsers with SsdMobilenetv1 Model #948

Closed
IgnaValdiviaUTN opened this issue Aug 12, 2024 · 1 comment

Comments

@IgnaValdiviaUTN
Copy link

Hi,

I'm experiencing inconsistent results when using the SsdMobilenetv1 model with face-api.js across different operating systems and browsers.

Comparativa face-api,js.pdf

Specifically, I'm running the following code to perform face recognition:

$(document).ready(function () {

        Promise.all([
            faceapi.nets.ssdMobilenetv1.loadFromUri("models/"),
            faceapi.nets.faceLandmark68Net.loadFromUri("models/"),
            faceapi.nets.faceRecognitionNet.loadFromUri("models/"),
            faceapi.nets.faceExpressionNet.loadFromUri("models/"),
            faceapi.nets.ageGenderNet.loadFromUri("models/"),
        ]).then(() => {
            console.log("Modelos cargados");
        });

        $("#enviar").click(async function () {
            
            const imagePath = "test/D6.png";

            
            const reconocimiento = {
                felicidad: 0,
                tristeza: 0,
                enojo: 0,
                temor: 0,
                neutralidad: 0,
                disgusto: 0,
                sorpresa: 0,
                edad: 0,
            };

            await procesarModeloJS(imagePath, reconocimiento);
        });
    });

    async function procesarModeloJS(imagePath, reconocimiento) {
        const img = new Image();
        img.src = imagePath;

        return new Promise((resolve) => {
            img.onload = async () => {
                try {
                    let predictions;

                    predictions = await faceapi
                        .detectSingleFace(img, new faceapi.SsdMobilenetv1Options())
                        .withFaceLandmarks()
                        .withFaceExpressions()
                        .withAgeAndGender();

                    if (predictions) {
                        Object.assign(reconocimiento, {
                            felicidad: predictions.expressions.happy * 100,
                            disgusto: predictions.expressions.disgusted * 100,
                            temor: predictions.expressions.fearful * 100,
                            enojo: predictions.expressions.angry * 100,
                            neutralidad: predictions.expressions.neutral * 100,
                            tristeza: predictions.expressions.sad * 100,
                            sorpresa: predictions.expressions.surprised * 100,
                            edad: predictions.age,
                        });

                    }
                } catch (error) {
                    console.error("Error en la predicción:", error);
                }

                resolve();
            };
        });
    }

The results vary significantly depending on the operating system and browser being used. For example, the accuracy of face detection, landmarks, expressions, age, and gender estimation differs between Windows and macOS, as well as between Chrome and Firefox.

Could you please provide some insights into why these discrepancies occur? Are there any known issues or limitations when using this model across different environments? Additionally, are there any recommended practices to ensure more consistent results?

Thank you for your help!

@IgnaValdiviaUTN
Copy link
Author

Just migrate code to backend with node js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant