Extract/Score NSFW images from local directory structures. Updated for Tensorflow2 and OpenNSFW2
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
conda create --name opennsfw2 python=3.9
conda activate opennsfw2
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
pip install --upgrade pip
pip install tensorflow
Ensure the correct conda environment is activated and run
pip install -r requirements.txt
Activate the conda environment you created above
conda activate opennsfw2
smutminer.py --help
usage: smutminer.py [-h] [-t THRESHOLD] [-l | --list | --no-list] [-v] [-a | --all | --no-all] {move,copy,link,score} [directory] [output]
positional arguments:
{move,copy,link,score}
Action to take, default: Print the image path and NSFW Score to stdout
directory Input Directory. Default: current working directory.
output Output Subdirectory. Default: ./nsfw
options:
-h, --help show this help message and exit
-t THRESHOLD, --threshold THRESHOLD
Default matching threshold for the open_nsfw model (0 - 1). Default: .7
-l, --list, --no-list
Write a list of original file paths to the output directory
-v, --verbose Output verbosity (1-3). Default: Print paths and scores only
-a, --all, --no-all Print scores for every image found