Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – FaceDetectorOptions.setMinFaceSize() is not working

Posted on November 14, 2022

Solution 1 :

It is the true, the image size is not a hard limitation, that is why we put the comment in the java doc.

“This is not a hard limit on face size; the detector may find faces slightly smaller than specified.“

You could increase the minFaceSize if you only have interests in larger faces. Or you could do a filtering for the size in your end. By increasing the minFaceSize, the performance will be improved.

Problem :

Currently i am using ML Kit to detect face in my application.
It’s working but has one problem. I want to set minimum face size on it but it seems to have no effect. It always detects a face no matter what size is it.

Here is my code:

private fun setupCamera(cameraProviderFuture: ListenableFuture<ProcessCameraProvider>, mainView: MainView) {
    val cameraProvider = cameraProviderFuture.get()

    preview = Preview.Builder().build()

    val cameraSelector = CameraSelector.Builder().requireLensFacing(CameraSelector.LENS_FACING_FRONT).build()

    val realTimeOpts = FaceDetectorOptions.Builder()
        .setPerformanceMode(FaceDetectorOptions.PERFORMANCE_MODE_FAST)
        .setMinFaceSize(0.5f)
        .enableTracking()
        .build()

    detector = FaceDetection.getClient(realTimeOpts)

    val imageAnalysis = ImageAnalysis.Builder()
        .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
        .build()
        .apply { setAnalyzer(Executors.newSingleThreadExecutor(), FaceDetectAnalyzer(detector!!, mainView))}

    try {
        cameraProvider.unbindAll()

        camera = cameraProvider.bindToLifecycle(this as LifecycleOwner, cameraSelector, imageAnalysis, preview)
        preview?.setSurfaceProvider(binding.pvCameraPreview.createSurfaceProvider())
    } catch (e: Exception) {
        Log.e(TAG, "Use case binding failed", e)
    }
}

Could someone point me any clues or suggestions? Thank you.

Comments

Comment posted by Selmeny

Do you mean it’s only related with performance? Because i tried to set it to max (1.0f) and it’s still not working. It always detects face no matter how small is it.

Comment posted by Shiyu

Yes, right now it is mainly for performance boosts. We use it to decide the block size when scanning the image. It can not be used directly to filter out face sizes, which we could improve. If you do want to filter out small faces, you may need to filter out in the app size with the return bounding box size.

READ  [ANSWERED] android - How to change icon and splash screen in ionic 6
Powered by Inline Related Posts

Comment posted by Selmeny

I see. So for now, i can filter it by using width of the bounding box size. Thank you.

Comment posted by Devansh Maurya

@Shiyu why can’t this explanation be there in the docs that it can not be used to filter out faces by sizes?

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress