r/AnimeResearch • u/HyenaTrash • Oct 20 '22
DeepCreamPy & Hent-AI Guide: Installation and anime censorship removal (Version 2) NSFW
06/23/2025 UPDATE: Hello everyone. After making my 01/13 update, I have received a tidal wave of private messages. These messages have informed me of two things:
Stable Diffusion's barrier to entry is much steeper for new users than I expected.
People value simplicity.
In light of these revelations, I have decided to reignite this project. If you're reading this, it means that I have already finished an update for DeepCreamPy that will allow anyone to use it with minimal fuss. I will be making a new guide for Version 3. Once it is done, you can find it here: LINK TO NEW GUIDE.
Please don't hesitate to reach out if you have questions. Thanks!
01/13/2025 UPDATE: Once in a while I get questions about this project through email or Reddit DMs, so I want to give everyone a quick update. In the past, decensoring hentai was equally difficult across the board, but has since become trivial with the introduction of consumer GUIs like ForgUI and Automatic1111 for Stable Diffusion. Because of this, there isn't much a huge need for DeepCreamPy and Hent-AI... Stable Diffusion is just better, and learning how to utilize it will be more effective than spending your time getting this project to work. My guide will (probably) still work if you follow everything perfectly, but I will not be providing much support for it in the future. If you have any questions about Stable Diffusion please let me know, and good luck in your future hentai adventures!
Hey everyone, welcome back. This guide is the updated version of my older, now deprecated revival project for DeepCreamPy and Hent-AI. I highly recommend following this version instead. For archival purposes, here is a link to the outdated version.
This project began when I discovered the unfortunate story behind DeepCreamPy, a tool for decensoring censored hentai. Thanks to the GitHub community I was able to recover recent versions from before the developer went dark, but the program itself was in bad shape and needed a unique environment to function. This effectively put it out of reach for casual users, so I'm hoping this guide will serve as an easy way to get everyone involved.
Please be sure to read Chapter 1: Introduction, it contains valuable information. It's important if you want to avoid problems and errors.
Index
Introduction
Preparing Python and Anaconda.
Installing Hent-AI.
Installing CenDetect.
Installing DeepCreamPy.
Using Hent-AI.
Using CenDetect.
Using DeepCreamPy.
Quick Start
Masking by Hand
FAQ
Notes & Updates
Sources and Credits
1. Introduction (Read this first)
This guide is divided into several chapters describing how to set up and use Anaconda3, Python, Hent-AI, CenDetect and DeepCreamPy (DCP). Each chapter assumes that you have read previous chapters. I understand that not everyone has the time or patience to go though all of this, so I'll be including a chapter called "Quick Start" which should do most of the work for you. I personally recommend following the full guide instead, since it will give you a better understand of where everything is.
Occasionally you will be given instructions, which are categorized by their chapter number and alphabetical position (for example, 2.B). This is so I can reference them later if anyone needs help, or if you need to communicate issues to me. Unless otherwise stated, always perform these tasks.
You will use the Anaconda Powershell Prompt many times throughout this tutorial. This is similar to Windows Command Prompt (CMD) and both are commonly referred to as a terminal. Whenever I say "Change your terminal directory to [DIRECTORY]" or "Open your terminal in [DIRECTORY]", what I mean is that you must navigate to that folder within Anaconda Powershell Prompt. This is what the Anaconda Powershell Prompt normally looks like, and this is what it looks like when you're "in the Hent-AI folder". You can change your terminal directory by inputting "cd", followed by folder's address surrounded in quotations. For example: cd "D:\Archive\900 - Software\Hent-AI"
I will also assume that you're running Anaconda as Administrator at all times.
What do these tools do? (Optional reading)
DeepCreamPy (DCP) is a neural network trained to "remove" censorship in manga and anime images/video. It does this by accepting pre-masked images and then filling in the masked areas. To my knowledge it's the only neural network built specifically for hentai, so it's a valuable resource if you want to decensor collections without hiring an artist or doing the work yourself.
Hent-AI is a tool designed to work with DCP by detecting the location of censorship and then applying a mask to it. Without Hent-AI you are forced to manually mask censorship by hand with an outside program like GIMP or Photoshop. Hent-AI can do this for you at a small cost to accuracy, but it generally gets the job done and even sends finished images to DCP's input folder.
CenDetect is an alternative to Hent-AI that could be considered a direct successor. It's faster, more efficient, relatively new and very flexible when it comes to package version compatibility. Both tools behave similarly but Hent-AI seems to have a slight edge when it comes to accuracy. That being said, I don't think either program should be used without user intervention, since both tend to miss spots occasionally. My setup will allow you to use both, so don't worry too much about which to choose.
2. Preparing Python and Anaconda
First we need to find out which Python version (if any) you currently have installed. Open Windows' Command Prompt (CMD) as Administrator, then input and run python --version (you can also use py --list to see all versions you have installed). If you see "Python 3.9" in the output then you can skip section 2.A of this chapter. Otherwise continue reading.
Requirements:
2.A
Download and install Python 3.9.13:
If you aren't using them, uninstall all other Python versions from your system, then restart.
Download Python 3.9 and start the installation.
Tick the "Add Python 3.9 to PATH" checkbox.
Select "Custom Installation" and make sure all of the boxes are ticked.
Finish installing, then restart your computer.
2.B
Download and install Anaconda:
Download Anaconda and start the installation.
Install for "All Users" if possible. Otherwise choose "Just Me".
When you arrive at Advanced Options, make sure the "Register Anaconda3 as the system Python 3.9" checkbox is ticked. Do not tick the "Add Anaconda3 to the system PATH environment variable" checkbox.
Install, then restart your computer.
2.C
Anaconda allows us to create environments to run our code and install packages in. You can think of these environments like boxes that prevent stuff from spilling out or altering other important things on your system. Before we do that, let's make sure Anaconda is ready:
Open your Start Menu and run "Anaconda Powershell Prompt (Anaconda3)" as Administrator. This window should pop up.
Input and run
conda update -n base -c defaults conda -y.Input and run
conda config --append channels conda-forge.Input and run
python -m pip install --upgrade pip.Keep this window open, we'll use it in the next steps.
2.D
Now that Anaconda is updated and ready, we can create our first environment. You can have multiple environments, but each should have a unique name. We'll be calling ours "deepcreambox" for simplicity.
Input and run
conda create -n deepcreambox python=3.7 -y.Input and run
conda env list. You should see two environments, "base" and "deepcreambox". Make sure "deepcreambox" is there before continuing.
2.E
We now have an Anaconda environment called "deepcreambox" that runs on Python 3.7. This is completely separate from your computer's Python installation, which is 3.9. Before doing anything, we need to activate deepcreambox in order to run commands in it. You must perform this step each time you start Anaconda, make changes, install packages or run your programs, so pay attention!
Input and run
conda activate deepcreambox.
Good, you are now inside the deepcreambox environment. We can verify this by checking the text in parenthesis to the left of our command line.
2.F
We're now going to install some requirements for DeepCreamPy, Hent-AI and CenDetect. We will have Python do this automatically using a text file I've created called "hyenatrash-requirements.txt".
Download hyenatrash-requirements.txt.
Change your terminal directory to the folder where you downloaded hyenatrash-requirements.txt.
Input and run
pip install -r hyenatrash-requirements.txt -f https://download.pytorch.org/whl/torch_stable.html. This may take a few minutes to finish, so give it time.When that's done, input and run
mim install mmcv-full==1.4.0.Restart your Anaconda terminal.
Congratulations, the hard part is over. Feel free to keep your Anaconda terminal open throughout this tutorial and remember to conda activate deepcreambox after restarting it. If you want to exit the environment, input and run conda deactivate.
3. Installing Hent-AI.
This chapter will guide you through installing Hent-AI. If you don't want to use Hent-AI, skip this chapter.
Requirements:
3.A
Download and extract Hent-AI, it's weights and the model:
Download Hent-AI_v1.6.9.zip and extract it somewhere nice.
Download weights268.zip and extract it to your Hent-AI directory.
Download 4x_FatalPixels_340000_G.pth and place it in your Hent-AI directory.
3.B
Run the setup.py script:
Open Anaconda Powershell Prompt (Anaconda3) as Administrator.
Input and run
conda activate deepcreamboxif you haven't already.Change your terminal directory to Hent-AI's directory.
Input and run
pythonsetup.pyinstall.
3.C
Create input folder and clean others:
Open your file explorer and navigate to Hent-AI's directory.
Create a folder called "input" in Hent-AI's directory.
Open the "ESR_output" folder and move/remove all images.
Hent-AI is now ready to use. To test it, open Anaconda Powershell Prompt (Anaconda3) as Administrator and run conda activate deepcreambox if you haven't already, then change your terminal directory to Hent-AI's directory. Input and run python main.py. A small GUI that looks like this should appear; if it doesn't then something went wrong and you should check your logs.
4. Installing CenDetect
This chapter will guide you through installing CenDetect. If you don't want to use CenDetect, skip this chapter.
Requirements:
4.A
Download CenDetect and it's models:
Download CenDetect_v1.0.zip and extract it somewhere nice.
Download CenDetect_models.zip and extract it to the "models" folder in CenDetect's directory.
CenDetect is now ready to use. To test it, open Anaconda Powershell Prompt (Anaconda3) as Administrator and run conda activate deepcreambox if you haven't already, then change your terminal directory to DenDetect's directory. Input and run python det.py. CenDetect should run in your terminal, there is no GUI.
5. Installing DeepCreamPy
This chapter will guide you through installing DeepCreamPy. Unlike Hent-AI and CenDetect, this tool is required to decensor your files.
Requirements:
5.A
Download and extract DCP and it's models:
Download DeepCreamPy-v2.2.0-beta.zip and extract it somewhere nice.
Download 09-11-2019_DCPv2.zip and extract it to DeepCreamPy's "models" folder.
5.B
Clean out these folders:
Open your file explorer and navigate to DeepCreamPy's directory.
Open "decensor_input" and move/remove all images.
Open "decensor_input_original" and move/remove all images.
Open "decensor_output" and move/remove all images.
DeepCreamPy is now ready to use. To test it, open Anaconda Powershell Prompt as Administrator and run conda activate deepcreambox if you haven't already, then change your terminal directory to DeepCreamPy's directory. Input and run python main.py. A GUI that looks like this should appear; if it doesn't then something went wrong and you should check your logs.
6. Using Hent-AI.
Hent-AI works by taking an image with mosaic or bar censorship, detecting the censorship location, and then placing a green mask over it. Hent-AI then sends the image(s) to DCP for processing. In this chapter we'll explore Hent-AI's various options and how to utilize them.
While Hent-AI does a good job at detecting censorship, it's not perfect. It struggles with manga, weird shapes, screentones, Ben Day dots and censorship bars of any color other than black. This means you should always check the masks on finished images to see if they require refinement. If they do, you will need to mask the missed portions by hand using an outside program like GIMP or Photoshop (see Chapter 10: Masking by Hand).
6.A
Place your censored image(s) in the right location:
Find censored image(s) you would like to mask (or download this image if you're lazy like me).
Place your image(s) into the "input" folder in Hent-AI's directory.
Warning: DO NOT place more than one type of censorship inside "input" at once. For example:
BAD: 3 images with bar censorship and 2 images with mosaic censorship.
GOOD: 6 images with bar censorship.
GOOD: 8 images with mosaic censorship.
6.B
Start Hent-AI:
Open Anaconda Powershell Prompt as Administrator.
Input and run
conda activate deepcreambox.Change your terminal directory to Hent-AI's directory.
Input and run
python main.py.Wait for this window to open.
This is Hent-AI's main GUI and it gives us some options. We'll be focusing exclusively on images since I haven't messed with video yet, but I imagine the same principles can be applied.
Bar: Use this when masking images with bar censorship. They will usually look something like this.
Mosaic (DCP): Use this when masking images with mosaic censorship. They will usually look something like this.
Mosaic (ESRGAN): Hent-AI's stand-alone decensor process. DCP does a better job so I wouldn't recommend this option, but if you want a quick fix it's available. The resulting image will be saved to the "ESR_output" folder in Hent-AI's directory.
6.C
Process the image(s):
Press Mosaic (DCP) or Bar, depending on your needs. This window should appear.
Next to "Your own input image folder:", press Browse and navigate to the "input" folder in Hent-AI's directory, then press Select Folder.
Next to "DeepCreamPy install folder:", press Browse and navigate to DeepCreamPy's directory, then press Select Folder.
Set your "Grow detection mask amount" (0 means no expansion, while 10 makes it expand a lot). 3 is a good default.
Press Go!
This process can take anywhere between a few seconds and a few minutes. When it's complete, a window should appear with the message, "Process executed successfully! Now you can run DeepCreamPy."
To test whether the masking was successful open your file explorer, navigate to DeepCreamPy's directory and look inside the "decensor_input" folder. You should see the processed image, it will contain a bright green mask where the censorship once was (like this).
7. Using CenDetect
CenDetect is a direct successor to Hent-AI. Like it's predecessor, it's a tool that can detect the location of mosaic/bar censorship and then apply a mask. It has a slight edge in terms of flexibility, speed and being newer.
Unfortunately there are some downsides. For example, it performs significantly worse with bar censorship during tests, despite picking up on a wider variety of bar shapes and colors than Hent-AI is able to. When it came to mosaics the results were competitive but I still believe Hent-AI is better.
It could be argued that the difference in quality doesn't matter, since you should be checking masked images and making necessary modifications either way. My build will allow you to use both tools, so don't be afraid to perform your own experiments.
7.A
Unlike other tools you've been working with up to this point, CenDetect does not have a GUI. You will need to learn how to use command line parameters in order to make it run. This is what a typical initialization command looks like:
python det.py --confidence 0.5 --input_path "C:\Archive\09 - Software\CenDetect\input" --output_path "C:\Archive\09 - Software\CenDetect\output" --model "mask_rcnn_r50_fpn"
This may seem confusing, but it will get clearer once we break it down.
pythondet.pyis familiar, you've been using similar commands to start other tools. This simply runs the "det.py" script, which initializes CenDetect.--confidence [FLOAT]is optional and tells CenDetect how confident we are in it's ability to detect censorship. 0.0 will not change anything (default), while 1.0 will indicate we have no confidence (nothing will get masked). Adjusting this number somewhere in-between (such as 0.5) can lead to highly customizable results, which is a huge point in favor of CenDetect over Hent-AI.--input_path "[PATH]"tells CenDetect where to look for censored images.--output_path "[PATH]"tells CenDetect where to send finished images when it's done masking them.--model "[MODEL_NAME]"is optional, but useful. CenDetect comes with 4 unique models that each take different approaches to masking. After running some tests, here are my observations:mask_rcnn_r50_fpn | This is the default model CenDetect will use if you don't choose one. It's a good all-rounder model but it's terrible at detecting bar censorship and tends to leave some open edges around the masked area.
point_rend_r50_fpn | This model seems to work best for detecting bar censorship, so I think that's it's purpose. It doesn't work well with mosaics.
mask_rcnn_r101_fpn | This model can detect both bar and mosaic censorship, but I found that it works better for mosaic. This one is my personal favorite because it's masking is similar to Hent-AI's quality.
cascade_mask_rcnn_r50_fpn_dconv | I have mixed feelings about this one. It's not supposed to work with a CPU, but it seems to do fine. It performs exceedinly well when it gets things right, but very badly when it gets them wrong. A wildcard, for sure.
Check out CenDet's GitHub page for more information.
7.B
Now that you understand how the command parameters work, it's time to try them out:
Open Anaconda Powershell Prompt as Administrator.
Input and run
conda activate deepcreamboxif you haven't already.Change your terminal directory to CenDetect's directory.
Input
pythondet.pybut do not run it yet.Add
--input_path "[PATH]"and--output_path "[PATH]".(Optional) Feel free to add more options such as
--confidence [FLOAT]or choose a model with--model [MODEL_NAME].Run the command.
To test whether masking was successful open your file explorer and navigate to the folder you set in --output_path. You should see the processed image, it will contain a bright green mask where the censorship once was (like this).
8. Using DeepCreamPy.
DeepCreamPy works by taking masked images in it's "decensor_input" folder and attempting to fill in the masked area using it's trained neural network. Masks are areas of an image that have been painted over in a bright green shade, either by hand or automatically with Hent-AI/CenDetect.
There are three important folders in the DCP directory:
"decensor_input", where masked images are placed. These masked images must be PNGs.
"decensor_input_original", where you should place the original unmasked images in JPG or PNG format.
"decensor_output", where decensored images are sent once DCP is done processing them.
8.A
Place your image(s) in the correct locations:
Open your file explorer and navigate to DeepCreamPy's directory.
Place your masked image(s) in the "decensor_input" folder. If you used Hent-AI, check to make sure the image(s) are there.
Place your original unmasked image(s) in the "decensor_input_original" folder. If you used Hent-AI, check to make sure the image(s) are there.
8.B
Start DeepCreamPy:
Open Anaconda Powershell Prompt as Administrator.
Input and run
conda activate deepcreamboxif you haven't already.Change your terminal directory to DeepCreamPy's directory.
Input and run
python main.py.Wait for this window to appear.
This is DCP's main GUI. On the left side we can tell DCP what kind of censorship it's dealing with, and on the right side we can tell it how many variations to generate. Each variation uses a slightly different but predictable approach to decensoring. More variations increases the chance of a high-quality outcome.
8.C
Process the image(s):
Under Censor Type, select the correct censor type (Bar censor or Mosaic censor).
Under Number of Decensor Variations, select how many variations you would like.
Press the Decensor Your Images button.
This window should appear, which contains two loading bars. The top bar shows your overall progress while the bottom bar displays the progress of each image DCP is currently working on. The neural network will take a while to load, but the actual decensoring process is rather quick. Be patient.
Once DCP is complete, finished image(s) can be found in the "decensor_output" folder.
It's good practice to move or delete finished images from all folders at this point, you don't want any surprises later on. With a little practice this process isn't very long, the only real bottlenecks are your CPU and time.
When you're ready to do another batch, close out DCP and go back to your Anaconda Powershell Prompt terminal. Press CTRL+C to reset the command line, then input and run python main.py to start again.
Now go forth and do dirty things.
9. Quick Guide
Still a WIP, but it will be far easier to create now so expect an update soon.
10. Masking by Hand
This chapter will be short, it mainly exists to provide a reference on how to correctly mask images. This is important because poor masks can lead to poor results, and nobody wants that.
Let's go over the rules:
You must use this color of green for masking: RGB 0,255,0 (#00ff00).
Your brush must have perfectly hard edges, not blurred. If you're using Photoshop try the Pencil tool instead.
Your mask must completely cover the censored area, especially in the case of bars.
Save all of your images in PNG format to avoid artifacts, which can lead to bad results.
When in doubt, consult the troubleshooting guide.
11. Frequently Asked Questions
"I'm getting a lot of errors, what should I do?"
Errors are often caused by faulty installations or missing packages. You should first try Googling the error to see if anyone else has an answer, usually Stack Exchange will have nifty solutions you can try. If that doesn't work you can always create a new Conda environment to play around in. Don't be afraid to experiment, that's the joy of Conda environments; if you mess up, just start over.
12. Notes & Updates
10/19/2022
Transitioned primary installation method from local Python to Anaconda.
Created a new reddit thread and deprecated old version.
Added CenDetect as Hent-AI alternative.
Updated existing instructions to be more concise and easier to follow.
Modified hyenatrash-requirements.txt to contain all necessary packages for full compatibility with DCP, Hent-AI and CenDetect.
Added new resources.
I thought about including a lengthy explanation about why we're switching to Anaconda, but I think something shorter will suffice.
Basically, changing your local Python installation in order to run several outdated programs is insecure, inefficient and takes a lot of time (especially if anything breaks). It also sucks if you want to install a newer Python program, but have to rely on older Python packages and versions. You could potentially end up restarting your computer dozens of times, uninstalling and reinstalling Python, messing with your PATHs and a whole lot more.
Thankfully there is a much better solution, which is where Anaconda comes in. Anaconda is a Python package and environment manager. Essentially, it allows you to create any number of "environments", each one isolated from each-other and your local system. For example, we could have one environment with Python 3.5, another with Python 3.7 and another with Python 3.10. Each environment also keeps their packages separated from one-another, so we don't have to worry about updating or downgrading versions.
More importantly, if you ever screw something up you can just delete that environment and start again. It saves you time, effort and sanity.
Transitioning to Anaconda may seem complicated, but once you get it running there's only a slight learning curve standing between you and an awesome experience. I highly recommend taking the leap.
09/20/2022
Added "FAQ" section to guide.
Rearranged some stuff.
08/22/2022
DeepCreamPy has an EXE version, but it was removed from GitHub when DCP's creator ceased development. This file is available to download from mao-shonen's DCP archive here. I have personally assaulted it with a slew of anti-virus detection tests and sandbox simulations and it appears to be clean and functional.
The exe itself is certainly easier to use; you don't have to install some Python dependencies. But honestly I don't think it makes a huge difference in regards to time.
That being said, here is the download for anyone interested: DeepCreamPy_2.2.0-beta_win64 executable.zip. Here is the scan from Virus Total.
Remember, it's always good practice to compare file hashes to make sure you're looking at the exact same file. What is a hash? It's a unique identifier for files, everything has one. If the file is modified in any way, the hash will change. For example, if you visit the Virus Total page for the .zip file I provided, you will notice a large string of numbers and letters near the top (in this case: edcb27a89603d10520a5b00072a1c944839101101a3acb941f478f71100dfb02). This is the file's hash.
But how do you compare the hash on Virus Total to the hash of the file you downloaded?
7.ATo find the hash of your downloaded file (or any file, for that matter):
Navigate to the folder you downloaded the file to.
Press
ALT+D, type "powershell" and press enter.Input and run
Get-FileHash -Path "DeepCreamPy_2.2.0-beta_win64 executable.zip" -Algorithm SHA256This will show you the file's hash. Compare it to the one found on Virus Total. You can now be certain it's the exact same file, nobody has modified it before giving it to you.
Also, fun tip: If you know a file's hash, you can search for that hash on Virus Total. This will show you if anyone else ever scanned that file using VT, which can be a quick way to do slick virus scans on the fly without having to upload anything!
13. Sources and Credits
I'd like to take a moment to appreciate the many developers and individuals who helped bring this project together, directly or otherwise. No contribution was insignificant. Thank you!
deeppomf - DeepCreamPy creator.
natethegreate - Hent-AI creator (GitHub).
styler00dollar - CenDetect creator (GitHub).
mao-shonen - For the DeepCreamPy repository archive + executable (GitHub)
u/SquishyThePotato - Special thanks to Squishy for reviving the GPU side of this project almost single-handedly. Their extensive experiments, updates and messages furthered my understanding and provided invaluable insight. Be sure to show them the gratitude they deserve for their hard work by upvoting their post.
Unnamed user (awaiting credit permission) - For bringing CenDetect to my attention and researching potential modern alternatives to Hent-AI.