imgutils.validate.furry

Overview:

A model for classifying anime furry images into 2 classes (non_furry, furry).

The following are sample images for testing.

../../_images/furry.plot.py.svg

This is an overall benchmark of all the furry classification models:

../../_images/furry_benchmark.plot.py.svg

The models are hosted on huggingface - deepghs/anime_furry.

anime_furry_score

imgutils.validate.furry.anime_furry_score(image: str | PathLike | bytes | bytearray | BinaryIO | Image, model_name: str = 'mobilenetv3_v0.1_dist') Dict[str, float][source]

Get the scores for different types in a furry anime image.

Parameters:
  • image (ImageTyping) – The input image.

  • model_name (str) – The model name. Default is ‘mobilenetv3_v0.1_dist’.

Returns:

A dictionary with type scores.

Return type:

Dict[str, float]

Examples::
>>> from imgutils.validate import anime_furry_score
>>>
>>> anime_furry_score('non_furry/1.jpg')  # non-furry images
{'non_furry': 0.9898804426193237, 'furry': 0.010119626298546791}
>>> anime_furry_score('non_furry/2.jpg')
{'non_furry': 0.9677742123603821, 'furry': 0.032225821167230606}
>>> anime_furry_score('non_furry/3.jpg')
{'non_furry': 0.959551215171814, 'furry': 0.040448784828186035}
>>> anime_furry_score('non_furry/4.jpg')
{'non_furry': 0.9535530209541321, 'furry': 0.04644693806767464}
>>>
>>> anime_furry_score('furry/5.jpg')  # furry images
{'non_furry': 0.04358793422579765, 'furry': 0.9564120769500732}
>>> anime_furry_score('furry/6.jpg')
{'non_furry': 0.02767963521182537, 'furry': 0.9723203182220459}
>>> anime_furry_score('furry/7.jpg')
{'non_furry': 0.028900373727083206, 'furry': 0.9710996150970459}
>>> anime_furry_score('furry/8.jpg')
{'non_furry': 0.037573859095573425, 'furry': 0.9624261260032654}

anime_furry

imgutils.validate.furry.anime_furry(image: str | PathLike | bytes | bytearray | BinaryIO | Image, model_name: str = 'mobilenetv3_v0.1_dist') Tuple[str, float][source]

Get the primary furry type and its score.

Parameters:
  • image (ImageTyping) – The input image.

  • model_name (str) – The model name. Default is ‘mobilenetv3_v0.1_dist’.

Returns:

A tuple with the primary type and its score.

Return type:

Tuple[str, float]

Examples::
>>> from imgutils.validate import anime_furry
>>>
>>> anime_furry('non_furry/1.jpg')  # non-furry images
('non_furry', 0.9898804426193237)
>>> anime_furry('non_furry/2.jpg')
('non_furry', 0.9677742123603821)
>>> anime_furry('non_furry/3.jpg')
('non_furry', 0.959551215171814)
>>> anime_furry('non_furry/4.jpg')
('non_furry', 0.9535530209541321)
>>>
>>> anime_furry('furry/5.jpg')  # furry images
('furry', 0.9564120769500732)
>>> anime_furry('furry/6.jpg')
('furry', 0.9723203182220459)
>>> anime_furry('furry/7.jpg')
('furry', 0.9710996150970459)
>>> anime_furry('furry/8.jpg')
('furry', 0.9624261260032654)