ChenglongMa / SkinToneClassifier

An easy-to-use library for skin tone classification
https://chenglongma.com/SkinToneClassifier/
GNU General Public License v3.0
97 stars 13 forks source link

Argument to disable face detection #1

Closed gaga23 closed 1 year ago

gaga23 commented 1 year ago

I had to clone the repository and manually edit the code to disable face dection. I want to run the SkinToneClassifier over images for which the face is already cropped. Running the present code (version 0.1.11) results in either 'NA' (which is what I want) or some small subregions of the face (which I want to avoid right now).

Some examples: 2_2_0_1_1_10_2-1 2_2_0_1_1_12_2-1

ChenglongMa commented 1 year ago

Hi @gaga23, thanks for your comments!

To solve your problem, you can either set --new_width to a smaller value, e.g., --new_width 200 or set --min_size to a large value, e.g., --min_size 500 500.

I've tested on your first example by running

stone -i ./example.jpg -d --new_width 200

And I got the following result message:

----- Processing example -----
Found 0 face, will detect global skin area instead
Dominant color(s) with proportion: ['#553331', '0.84', '#7B645D', '0.16']
Classified color category: #513b2e, distance: 9.459270010669316
100%|██████████| 1/1 [00:00<00:00,  3.96it/s]

Imagine we are using a scanner to scan the image to find a part of the face. False detections are either because the image size is too large or the scanner is too small and therefore thinks a small area is a "face".

So the solution as shown above is to adjust the parameter to resize the image or scanner.

Hope it can help! Thanks!

gaga23 commented 1 year ago

Thx!