{"id":37074184,"url":"https://github.com/deepghs/realutils","last_synced_at":"2026-01-14T08:44:05.160Z","repository":{"id":272327842,"uuid":"766867478","full_name":"deepghs/realutils","owner":"deepghs","description":"A convenient and user-friendly image data processing library that integrates various advanced image processing models.","archived":false,"fork":false,"pushed_at":"2025-05-14T09:00:39.000Z","size":80259,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T15:39:40.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dghs-realutils.deepghs.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepghs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-04T09:25:15.000Z","updated_at":"2025-07-17T06:38:06.000Z","dependencies_parsed_at":"2025-05-14T09:51:17.821Z","dependency_job_id":null,"html_url":"https://github.com/deepghs/realutils","commit_stats":null,"previous_names":["deepghs/realutils"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/deepghs/realutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepghs%2Frealutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepghs%2Frealutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepghs%2Frealutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepghs%2Frealutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepghs","download_url":"https://codeload.github.com/deepghs/realutils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepghs%2Frealutils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T08:44:04.348Z","updated_at":"2026-01-14T08:44:05.153Z","avatar_url":"https://github.com/deepghs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# realutils\n\n[![PyPI](https://img.shields.io/pypi/v/dghs-realutils)](https://pypi.org/project/dghs-realutils/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dghs-realutils)\n![Loc](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/narugo1992/2df500fa7fddd97549d0e027680b9c8f/raw/loc.json)\n![Comments](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/narugo1992/2df500fa7fddd97549d0e027680b9c8f/raw/comments.json)\n\n[![Code Test](https://github.com/deepghs/realutils/workflows/Code%20Test/badge.svg)](https://github.com/deepghs/realutils/actions?query=workflow%3A%22Code+Test%22)\n[![Package Release](https://github.com/deepghs/realutils/workflows/Package%20Release/badge.svg)](https://github.com/deepghs/realutils/actions?query=workflow%3A%22Package+Release%22)\n[![codecov](https://codecov.io/gh/deepghs/realutils/branch/main/graph/badge.svg?token=XJVDP4EFAT)](https://codecov.io/gh/deepghs/realutils)\n\n[![Discord](https://img.shields.io/discord/1157587327879745558?style=social\u0026logo=discord\u0026link=https%3A%2F%2Fdiscord.gg%2FTwdHJ42N72)](https://discord.gg/TwdHJ42N72)\n![GitHub Org's stars](https://img.shields.io/github/stars/deepghs)\n[![GitHub stars](https://img.shields.io/github/stars/deepghs/realutils)](https://github.com/deepghs/realutils/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/deepghs/realutils)](https://github.com/deepghs/realutils/network)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/deepghs/realutils)\n[![GitHub issues](https://img.shields.io/github/issues/deepghs/realutils)](https://github.com/deepghs/realutils/issues)\n[![GitHub pulls](https://img.shields.io/github/issues-pr/deepghs/realutils)](https://github.com/deepghs/realutils/pulls)\n[![Contributors](https://img.shields.io/github/contributors/deepghs/realutils)](https://github.com/deepghs/realutils/graphs/contributors)\n[![GitHub license](https://img.shields.io/github/license/deepghs/realutils)](https://github.com/deepghs/realutils/blob/master/LICENSE)\n\nA convenient and user-friendly image data processing library that integrates various advanced image processing models.\n\n## Installation\n\nYou can simply install it with `pip` command line from the official PyPI site.\n\n```shell\npip install dghs-realutils\n```\n\nIf your operating environment includes a available GPU, you can use the following installation command to achieve higher\nperformance:\n\n```shell\npip install dghs-realutils[gpu]\n```\n\nFor more information about installation, you can refer\nto [Installation](https://deepghs.github.io/realutils/main/tutorials/installation/index.html).\n\n## Supported or Developing Features\n\n`realutils` includes many generic usable features which are available on non-GPU device.\nFor detailed descriptions and examples, please refer to the\n[official documentation](https://deepghs.github.io/realutils/main/index.html).\nHere, we won't go into each of them individually.\n\n### Real Human Photo Tagger\n\nWe have tagger for real human photos, like this\n\n![idolsankaku_tagger](https://github.com/deepghs/realutils/blob/main/docs/source/api_doc/tagging/idolsankaku_demo_readme.plot.py.svg)\n\nWe can use `get_idolsankaku_tags` to tag them\n\n```python\nfrom realutils.tagging import get_idolsankaku_tags\n\nrating, general, character = get_idolsankaku_tags('idolsankaku/1.jpg')\nprint(rating)\n# {'safe': 0.748395562171936, 'questionable': 0.22442740201950073, 'explicit': 0.022273868322372437}\nprint(general)\n# {'1girl': 0.7476911544799805, 'asian': 0.3681548237800598, 'skirt': 0.8094233274459839, 'solo': 0.44033104181289673, 'blouse': 0.7909733057022095, 'pantyhose': 0.8893758654594421, 'long_hair': 0.7415428161621094, 'brown_hair': 0.4968719780445099, 'sitting': 0.49351146817207336, 'high_heels': 0.41397374868392944, 'outdoors': 0.5279690623283386, 'non_nude': 0.4075928330421448}\nprint(character)\n# {}\n\nrating, general, character = get_idolsankaku_tags('idolsankaku/7.jpg')\nprint(rating)\n# {'safe': 0.9750080704689026, 'questionable': 0.0257779061794281, 'explicit': 0.0018109679222106934}\nprint(general)\n# {'1girl': 0.5759814381599426, 'asian': 0.46296364068984985, 'skirt': 0.9698911905288696, 'solo': 0.6263223886489868, 'female': 0.5258357524871826, 'blouse': 0.8670071959495544, 'twintails': 0.9444552659988403, 'pleated_skirt': 0.8233045935630798, 'miniskirt': 0.8354354500770569, 'long_hair': 0.8752110004425049, 'looking_at_viewer': 0.4927205741405487, 'detached_sleeves': 0.9382797479629517, 'shirt': 0.8463951945304871, 'tie': 0.8901710510253906, 'aqua_hair': 0.9376567006111145, 'armpit': 0.5968506336212158, 'arms_up': 0.9492673873901367, 'sleeveless_blouse': 0.9789504408836365, 'black_thighhighs': 0.41496211290359497, 'sleeveless': 0.9865490198135376, 'default_costume': 0.36392033100128174, 'sleeveless_shirt': 0.9865082502365112, 'very_long_hair': 0.3988983631134033}\nprint(character)\n# {'hatsune_miku': 0.9460012912750244}\n```\n\nFor more details,\nsee: [documentation of get_idolsankaku_tags](https://dghs-realutils.deepghs.org/main/api_doc/tagging/idolsankaku.html#get-idolsankaku-tags).\n\n### Generic Object Detection\n\nWe use official YOLO models the generic purpose of object detections.\n\n![object_detection](https://github.com/deepghs/realutils/blob/gh-pages/main/_images/yolo_demo.plot.py.svg)\n\nWe can use `detect_by_yolo` for generic object detection\n\n```python\nfrom realutils.detect import detect_by_yolo\n\nprint(detect_by_yolo('yolo/unsplash_aJafJ0sLo6o.jpg'))\n# [((450, 317, 567, 599), 'person', 0.9004617929458618)]\nprint(detect_by_yolo('yolo/unsplash_n4qQGOBgI7U.jpg'))\n# [((73, 101, 365, 409), 'vase', 0.9098997116088867), ((441, 215, 659, 428), 'vase', 0.622944176197052), ((5, 1, 428, 377), 'potted plant', 0.5178268551826477)]\nprint(detect_by_yolo('yolo/unsplash_vUNQaTtZeOo.jpg'))\n# [((381, 103, 676, 448), 'bird', 0.9061452150344849)]\nprint(detect_by_yolo('yolo/unsplash_YZOqXWF_9pk.jpg'))\n# [((315, 100, 690, 532), 'horse', 0.9453459978103638), ((198, 181, 291, 256), 'horse', 0.917123556137085), ((145, 173, 180, 249), 'horse', 0.7972317337989807), ((660, 138, 701, 170), 'horse', 0.4843617379665375)]\n```\n\nMore models are hosted on [huggingface repository](https://huggingface.co/deepghs/yolos).\nAn online demo are provided as well, you can try [it](https://huggingface.co/spaces/deepghs/yolos) out.\n\n### Face Detection\n\nWe use YOLO models from [deepghs/real_face_detection](https://huggingface.co/deepghs/real_face_detection) for face\ndetection.\n\n![face_detection](https://github.com/deepghs/realutils/blob/gh-pages/main/_images/face_detect_demo.plot.py.svg)\n\nWe can use `detect_faces` for face detection\n\n```python\nfrom realutils.detect import detect_faces\n\nprint(detect_faces('yolo/solo.jpg'))\n# [((168, 79, 245, 199), 'face', 0.7996422052383423)]\nprint(detect_faces('yolo/2girls.jpg'))\n# [((721, 152, 1082, 726), 'face', 0.8811314702033997), ((158, 263, 509, 714), 'face', 0.8745490908622742)]\nprint(detect_faces('yolo/3+cosplay.jpg'))\n# [((351, 228, 410, 302), 'face', 0.8392542600631714), ((384, 63, 427, 116), 'face', 0.8173024654388428), ((195, 109, 246, 161), 'face', 0.8126493692398071)]\nprint(detect_faces('yolo/multiple.jpg'))\n# [((1074, 732, 1258, 987), 'face', 0.8792377710342407), ((1378, 536, 1541, 716), 'face', 0.8607611656188965), ((554, 295, 759, 557), 'face', 0.8541485071182251), ((897, 315, 1068, 520), 'face', 0.8539882898330688), ((1194, 230, 1329, 403), 'face', 0.8324605226516724)]\n```\n\nMore models are hosted on [huggingface repository](https://huggingface.co/deepghs/real_face_detection).\nAn online demo are provided as well, you can try [it](https://huggingface.co/spaces/deepghs/real_object_detection) out.\n\n### Feature Extractor\n\nWe support DINOv2-based image feature extractor, like this\n\n```python\nfrom realutils.metrics import get_dinov2_embedding\n\nembedding = get_dinov2_embedding('unsplash_0aLd44ICcpg.jpg')\nprint(embedding.shape)\n# (768,)\n```\n\nYou can use this embedding, calculating their cosine similarities to measure their visual similarities.\n\n### Image-Text Models\n\nWe support both CLIP and SigLIP for multimodal alignment operations, like this\n\n* CLIP\n\n```python\nfrom realutils.metrics.clip import classify_with_clip\n\nprint(classify_with_clip(\n    images=[\n        'xlip/1.jpg',\n        'xlip/2.jpg'\n    ],\n    texts=[\n        'a photo of a cat',\n        'a photo of a dog',\n        'a photo of a human',\n    ],\n))\n# array([[0.98039913, 0.00506729, 0.01453355],\n#       [0.05586662, 0.02006196, 0.92407143]], dtype=float32)\n```\n\n* SigLIP\n\n```python\nfrom realutils.metrics.siglip import classify_with_siglip\n\nprint(classify_with_siglip(\n    images=[\n        'xlip/1.jpg',\n        'xlip/2.jpg',\n    ],\n    texts=[\n        'a photo of a cat',\n        'a photo of 2 cats',\n        'a photo of 2 dogs',\n        'a photo of a woman',\n    ],\n))\n# array([[1.3782851e-03, 2.7010253e-01, 9.7517688e-05, 3.6702781e-09],\n#        [3.3248414e-06, 2.2294161e-07, 1.9753381e-09, 2.2561464e-06]],\n#       dtype=float32)\n```\n\nFor more details, you can take a look at:\n\n* [Documentation of realutils.metrics.clip](https://dghs-realutils.deepghs.org/main/api_doc/metrics/clip.html)\n* [Models of CLIP](https://huggingface.co/deepghs/clip_onnx)\n* [Documentation of realutils.metrics.siglip](https://dghs-realutils.deepghs.org/main/api_doc/metrics/siglip.html)\n* [Models of SigLIP](https://huggingface.co/deepghs/siglip_onnx)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepghs%2Frealutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepghs%2Frealutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepghs%2Frealutils/lists"}