Giter Site home page Giter Site logo

gestur1976 / familysafe-nsfw-finder Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 15 KB

This program searches through a directory tree to find images that are not safe for work (NSFW) by using a machine learning algorithm. It then relocates these images to a designated directory.

License: MIT License

Python 100.00%

familysafe-nsfw-finder's Introduction

NSFW Image Scanner

Description

This script scans a directory for images and uses a classifier model to detect NSFW (Not Safe For Work) content. If NSFW content is found, the script can optionally move these images to a specified directory. It supports recursive scanning of directories.

Features

  • Scans specified directories for image files (JPG, JPEG, PNG, GIF).
  • Uses Falconsai/nsfw_image_detection model to classify images as NSFW or safe.
  • Can move detected NSFW images to a chosen directory.
  • Option for recursive directory scanning.

Requirements

  • Python 3.x
  • Anaconda or Miniconda (for TensorFlow and Keras support)

Installation

  1. Ensure Python 3.x is installed on your system.
  2. Clone the repository or download the script.
  3. Create a Conda environment:
conda create -n nsfw_scanner python=3.9
conda activate nsfw_scanner
  1. Set up the conda environment:
conda install cuda-toolkit cudnn tensorflow -c "nvidia/label/cuda-11.8.0"
conda env config vars set LD_LIBRARY_PATH=$CONDA_PREFIX/lib
conda deactivate
conda activate nsfw_scanner
  1. Install required Python packages:
pip install -r requirements.txt

Usage

Activate the conda environment before using the script.

Run the script via command line, specifying the source directory and, if desired, a destination folder for detected images:

conda activate nsfw_scanner
python nsfw-scanner.py [directory] [options]

Arguments

  • directory: The directory scan.
  • -r, --recursive: Scan subdirectories recursively.
  • [ -t, --target directory ]: Optional target directory for NSFW files.

Example

python nsfw-scanner.py ~/Images --recursive --target ~/.nsfw_images
or
# to disable NUMA warnings if you get them prepend the following env VAR to your command
TF_CPP_MIN_LOG_LEVEL=3 python nsfw-scanner.py ~/Images --recursive --target ~/.nsfw_images

Notes

  • NSFW detection accuracy depends on the model.
  • Internet access is required to download the model on first run.

License

Licensed under the MIT License - see the LICENSE file for details.

Contribution

Contributions to the project are welcome. Please fork the repository and submit a pull request with your changes.

Disclaimer

This tool is for educational use only. The author is not responsible for misuse or any resulting damage.

familysafe-nsfw-finder's People

Contributors

gestur1976 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.