NudeNetClassifier


NameNudeNetClassifier JSON
Version 2.1.1 PyPI version JSON
download
home_pagehttps://github.com/platelminto/NudeNetClassifier
SummaryA Neural Net for Nudity Detection. Classifier only.
upload_time2023-01-23 12:55:18
maintainer
docs_urlNone
authorGiorgio Momigliano
requires_python>=3.6.0
licenseGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring

[![DOI](https://zenodo.org/badge/173154449.svg)](https://zenodo.org/badge/latestdoi/173154449) ![Upload Python package](https://github.com/notAI-tech/NudeNet/actions/workflows/python-publish.yml/badge.svg)


## Fork differences:

- Only the default classifier is available.
- The classifier no longer throws the `Initializer block1_conv1_bn/keras_learning_phase:0 appears in graph inputs 
  and will not be treated as constant value/weight. etc.` warning.
- It only works on images.
- The classifier is included in the project itself.
- Only the v2 model is available (the original repo's default). So `v2` from original is `main` here.

Uncensored version of the following image can be found at https://i.imgur.com/rga6845.jpg (NSFW)

![](https://i.imgur.com/0KPJbl9.jpg)

**Classifier classes:**
|class name   |  Description    |
|--------|:--------------:
|safe | Image is not sexually explicit     |
|unsafe | Image is sexually explicit|


# As self-hostable API service
```bash
# Classifier
docker run -it -p8080:8080 notaitech/nudenet:classifier

# See fastDeploy-file_client.py for running predictions via fastDeploy's REST endpoints 
wget https://raw.githubusercontent.com/notAI-tech/fastDeploy/master/cli/fastDeploy-file_client.py
# Single input
python fastDeploy-file_client.py --file PATH_TO_YOUR_IMAGE

# Client side batching
python fastDeploy-file_client.py --dir PATH_TO_FOLDER --ext jpg
```

**Note: golang example https://github.com/notAI-tech/NudeNet/issues/63#issuecomment-729555360**, thanks to [Preetham Kamidi](https://github.com/preetham)


# As Python module
**Installation**:
```bash
pip install -U git+https://github.com/platelminto/NudeNet
```

**Classifier Usage**:
```python
# Import module
from nudenet import NudeClassifier

# initialize classifier (downloads the checkpoint file automatically the first time)
classifier = NudeClassifier()

# Classify single image
classifier.classify('path_to_image_1')
# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}
# Classify multiple images (batch prediction)
# batch_size is optional; defaults to 4
classifier.classify(['path_to_image_1', 'path_to_image_2'], batch_size=BATCH_SIZE)
# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY},
#          'path_to_image_2': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}
```

# Notes:
- The current version of NudeDetector is trained on 160,000 entirely auto-labelled (using classification heat maps and 
  various other hybrid techniques) images. 
- The entire data for the classifier is available at https://archive.org/details/NudeNet_classifier_dataset_v1
- A part of the auto-labelled data (Images are from the classifier dataset above) used to train the base Detector is available at https://github.com/notAI-tech/NudeNet/releases/download/v0/DETECTOR_AUTO_GENERATED_DATA.zip

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/platelminto/NudeNetClassifier",
    "name": "NudeNetClassifier",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Giorgio Momigliano",
    "author_email": "gmomigliano@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/54/2f/9b500741f7116050f49b0c8cc4390230063f58219cf0f2882c3cfa07791c/NudeNetClassifier-2.1.1.tar.gz",
    "platform": null,
    "description": "\n# NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring\n\n[![DOI](https://zenodo.org/badge/173154449.svg)](https://zenodo.org/badge/latestdoi/173154449) ![Upload Python package](https://github.com/notAI-tech/NudeNet/actions/workflows/python-publish.yml/badge.svg)\n\n\n## Fork differences:\n\n- Only the default classifier is available.\n- The classifier no longer throws the `Initializer block1_conv1_bn/keras_learning_phase:0 appears in graph inputs \n  and will not be treated as constant value/weight. etc.` warning.\n- It only works on images.\n- The classifier is included in the project itself.\n- Only the v2 model is available (the original repo's default). So `v2` from original is `main` here.\n\nUncensored version of the following image can be found at https://i.imgur.com/rga6845.jpg (NSFW)\n\n![](https://i.imgur.com/0KPJbl9.jpg)\n\n**Classifier classes:**\n|class name   |  Description    |\n|--------|:--------------:\n|safe | Image is not sexually explicit     |\n|unsafe | Image is sexually explicit|\n\n\n# As self-hostable API service\n```bash\n# Classifier\ndocker run -it -p8080:8080 notaitech/nudenet:classifier\n\n# See fastDeploy-file_client.py for running predictions via fastDeploy's REST endpoints \nwget https://raw.githubusercontent.com/notAI-tech/fastDeploy/master/cli/fastDeploy-file_client.py\n# Single input\npython fastDeploy-file_client.py --file PATH_TO_YOUR_IMAGE\n\n# Client side batching\npython fastDeploy-file_client.py --dir PATH_TO_FOLDER --ext jpg\n```\n\n**Note: golang example https://github.com/notAI-tech/NudeNet/issues/63#issuecomment-729555360**, thanks to [Preetham Kamidi](https://github.com/preetham)\n\n\n# As Python module\n**Installation**:\n```bash\npip install -U git+https://github.com/platelminto/NudeNet\n```\n\n**Classifier Usage**:\n```python\n# Import module\nfrom nudenet import NudeClassifier\n\n# initialize classifier (downloads the checkpoint file automatically the first time)\nclassifier = NudeClassifier()\n\n# Classify single image\nclassifier.classify('path_to_image_1')\n# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}\n# Classify multiple images (batch prediction)\n# batch_size is optional; defaults to 4\nclassifier.classify(['path_to_image_1', 'path_to_image_2'], batch_size=BATCH_SIZE)\n# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY},\n#          'path_to_image_2': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}\n```\n\n# Notes:\n- The current version of NudeDetector is trained on 160,000 entirely auto-labelled (using classification heat maps and \n  various other hybrid techniques) images. \n- The entire data for the classifier is available at https://archive.org/details/NudeNet_classifier_dataset_v1\n- A part of the auto-labelled data (Images are from the classifier dataset above) used to train the base Detector is available at https://github.com/notAI-tech/NudeNet/releases/download/v0/DETECTOR_AUTO_GENERATED_DATA.zip\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "A Neural Net for Nudity Detection. Classifier only.",
    "version": "2.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "542f9b500741f7116050f49b0c8cc4390230063f58219cf0f2882c3cfa07791c",
                "md5": "b6fb7f3198bf924531598ace0d991344",
                "sha256": "6299ed295b46cc2af6620a5e335c26155b87856e0f5e36de374e6c64117be52f"
            },
            "downloads": -1,
            "filename": "NudeNetClassifier-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b6fb7f3198bf924531598ace0d991344",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 77188291,
            "upload_time": "2023-01-23T12:55:18",
            "upload_time_iso_8601": "2023-01-23T12:55:18.206173Z",
            "url": "https://files.pythonhosted.org/packages/54/2f/9b500741f7116050f49b0c8cc4390230063f58219cf0f2882c3cfa07791c/NudeNetClassifier-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-23 12:55:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "platelminto",
    "github_project": "NudeNetClassifier",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nudenetclassifier"
}
        
Elapsed time: 0.09351s