Home > Enterprise >  Best image format for face detection and face recognition with the DeepFace library
Best image format for face detection and face recognition with the DeepFace library

Time:12-19

I'm using the DeepFace library for face recognition and detection.

I was wondering if there is a better format (png, jpg, etc) than others to get better results.

Is there a preferred image format for face recognition and face detection generally? and specifically in this library?

CodePudding user response:

Deepface is wrapped around several face recognition frameworks so the answer to your question should be: it is case-depending issue. However, all basic FR fameworks are not working with the original inpit images, they converting them first to greyscale, downsizing, making numpy arrays and so on usually using OpenCV and PIL for that. So... So, my oppinion is that image file format does not matter. Image file size, colour depth do matter.

CodePudding user response:

This answer is based on an answer from 'Bhargav'.

In python, images are processed as bit bitmaps using the color depth of the graphic system. Converting a PNG image to a bitmap is really fast (20 x times) when compared to jpegs. In my case, I had the image and needed to save it before proceeding, so I saved it as png so I won't lose quality (jpg is lossy).

Deepace - Currently accepting only 2 types of image input formats. PNG/Jpeg. there is no way to use other formats of images directly as you are using their libraries. If you want to use another input formats so then at least you need to convert either to PNG or Jpeg to give input to the functions. Which may cost you extra execution time while bringing other format images to PNG/Jpegs.

If you want to improve face recognition and face detection with deepface library then use some preprocessing filters.

Some of the filters you can try for better results. ultimate guide

  • Grayscale conversions
  • Face straightening
  • Face cropping (#Deepcae automatically do this while processing so no need to this)
  • Image resizing
  • Normalization
  • Image enhancement with PIL like sharpening.
  • image equalization.

Some basic filtering will be done by deepface. If your results are not accurate, which means filtering done by deepface is not sufficient, you have to try each and every filter. Something like a trail and error method until you got good results. sharpening and grayscaling are the first methods to try.

  • Related