DeepCreamPy/README.md

168 lines
8.1 KiB
Markdown
Raw Normal View History

2018-10-20 04:30:35 +00:00
# DeepCreamPy
2018-10-21 05:39:49 +00:00
*Decensoring Hentai with Deep Neural Networks. Formerly named DeepMindBreak.*
2018-10-20 04:00:04 +00:00
2018-10-30 11:39:08 +00:00
A deep learning-based tool to automatically replace censored artwork in hentai with plausible reconstructions.
2018-10-30 08:30:27 +00:00
2018-10-30 11:39:08 +00:00
The user specifies the censored regions in each image by coloring those regions green in a separate image editing program like GIMP or Photoshop. A neural network handles the hard part of filling in the censored regions.
2018-10-30 08:30:27 +00:00
DeepCreamPy has a pre-built binary for Windows 64-bit. DeepCreamPy works on Windows, Mac, and Linux.
2018-10-20 04:00:04 +00:00
![Censored, decensored](/readme_images/mermaid_collage.png)
2018-10-25 22:35:49 +00:00
## What's New?
2018-10-20 04:00:04 +00:00
- Decensoring images of ANY size
2018-10-21 05:51:58 +00:00
- Decensoring censors of ANY shape (e.g. bunch of black lines, pink hearts, etc.)
2018-10-20 04:00:04 +00:00
- Higher quality decensors
2018-10-27 07:08:51 +00:00
- Support for mosaic decensors (still a WIP and not very usable)
2018-10-30 08:30:27 +00:00
- User interface (not usable)
2018-10-20 04:00:04 +00:00
2018-10-25 22:35:49 +00:00
## Installation
2018-10-21 21:44:08 +00:00
2018-10-25 22:35:49 +00:00
### Download Prebuilt Binaries
2018-10-21 08:26:55 +00:00
You can download the latest release [here](https://github.com/deeppomf/DeepCreamPy/releases/latest) or find all previous releases [here](https://github.com/deeppomf/DeepCreamPy/releases).
2018-10-21 21:44:08 +00:00
Binary only available for Windows 64-bit.
2018-10-25 22:35:49 +00:00
### Run Code Yourself
2018-10-21 21:44:08 +00:00
If you want to run the code yourself, you can clone this repo and download the model from https://drive.google.com/open?id=1byrmn6wp0r27lSXcT9MC4j-RQ2R04P1Z. Unzip the file into the /models/ folder.
2018-10-25 22:35:49 +00:00
#### Dependencies (for running the code yourself)
2018-10-29 08:51:24 +00:00
- Python 3.6.7
2018-10-21 21:44:08 +00:00
- TensorFlow 1.10
2018-10-21 22:43:04 +00:00
- Keras 2.2.4
2018-10-21 21:44:08 +00:00
- Pillow
- h5py
2018-10-21 08:26:55 +00:00
2018-10-29 08:51:24 +00:00
No GPU required! Tested on Ubuntu 16.04 and Windows. Tensorflow on Windows is compatible with Python 3 and not Python 2. Tensorflow is not compatible with Python 3.7.
2018-10-21 21:44:08 +00:00
2018-10-25 22:34:02 +00:00
Tensorflow, Keras, Pillow, and h5py can all be installed by running in the command line
2018-10-21 21:44:08 +00:00
```
$ pip install -r requirements.txt
```
2018-10-21 08:26:55 +00:00
2018-10-25 22:35:49 +00:00
## Limitations
2018-10-25 22:34:02 +00:00
The decensorship is intended to work on color hentai images that have minor to moderate censorship of the penis or vagina. If a vagina or penis is completely censored out, decensoring will be ineffective.
2018-10-20 22:12:38 +00:00
2018-10-20 04:00:04 +00:00
It does NOT work with:
2018-10-25 22:34:02 +00:00
- Black and white/Monochrome image
2018-10-20 04:00:04 +00:00
- Hentai containing screentones (e.g. printed hentai)
- Real life porn
- Censorship of nipples
- Censorship of anus
- Animated gifs/videos
2018-10-25 22:35:49 +00:00
## Usage
### I. Decensoring bar censors
2018-10-20 04:42:48 +00:00
2018-10-20 06:10:26 +00:00
For each image you want to decensor, using image editing software like Photoshop or GIMP to color the areas you want to decensor the green color (0,255,0), which is a very bright green color.
2018-10-20 04:00:04 +00:00
2018-10-20 06:10:26 +00:00
*I strongly recommend you use the pencil tool and NOT the brush tool.*
*If you aren't using the pencil tool, BE SURE TO TURN OFF ANTI-ALIASING on the tool you are using.*
2018-10-20 04:00:04 +00:00
2018-10-30 08:30:27 +00:00
I personally use the wand selection tool with anti-aliasing turned off to select the censored regions. I then expand the selections slightly, pick the color (0,255,0), and use the paint bucket tool on the selected regions.
2018-10-20 04:00:04 +00:00
To expand selections in Photoshop, do Selection > Modify > Expand or Contract.
To expand selections in GIMP, do Select > Grow.
2018-10-20 05:27:53 +00:00
Save these images in the PNG format to the "decensor_input" folder.
2018-10-25 22:35:49 +00:00
#### A. Using the binary
2018-10-20 05:27:53 +00:00
2018-10-20 05:30:20 +00:00
Decensor the images by double-clicking on the decensor file.
2018-10-20 05:27:53 +00:00
2018-10-25 22:35:49 +00:00
#### B. Running from scratch
2018-10-20 05:27:53 +00:00
Decensor the images by running
2018-10-20 04:00:04 +00:00
```
$ python decensor.py
```
2018-10-20 07:17:33 +00:00
Decensored images will be saved to the "decensor_output" folder. Decensoring takes a few minutes per image.
2018-10-20 04:00:04 +00:00
2018-10-25 22:35:49 +00:00
### II. Decensoring mosaic censors
2018-10-20 04:42:48 +00:00
As with decensoring bar censors, perform the same steps of coloring the censored regions green and putting the colored image into the "decensor_input" folder.
2018-10-21 06:47:04 +00:00
In addition, move the original, uncolored images into the "decensor_input_original" folder. Ensure each original image has the same names as their corresponding colored version in the "decensor_input" folder.
For example, if the original image is called "mermaid.jpg," then you want to put this image in the "decensor_input_original" folder and, after you colored the censored regions, name the colored image "mermaid.png" and move it to the "decensor_input" folder.
2018-10-25 22:35:49 +00:00
#### A. Using the binary
2018-10-21 05:37:43 +00:00
Decensor the images by double-clicking on the decensor_mosaic file.
2018-10-25 22:35:49 +00:00
#### B. Running from scratch
Decensor the images by running
```
$ python decensor.py --is_mosaic=True
```
Decensored images will be saved to the "decensor_output" folder. Decensoring takes a few minutes per image.
2018-10-20 04:42:48 +00:00
2018-10-25 22:35:49 +00:00
### III. Decensoring with the user interface
2018-10-20 04:42:48 +00:00
To be implemented.
2018-10-25 22:35:49 +00:00
## Troubleshooting
2018-10-30 01:48:00 +00:00
### Installation
```
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
```
See https://github.com/deeppomf/DeepCreamPy/issues/26#issuecomment-434043166
2018-10-30 01:48:00 +00:00
### Decensoring
2018-10-25 22:34:02 +00:00
If your decensor output looks like this, then the censored regions were not colored correctly.
2018-10-20 07:18:30 +00:00
2018-10-20 07:17:33 +00:00
![Bad decensor](/readme_images/mermaid_face_censored_bad_decensor.png)
2018-10-20 07:18:30 +00:00
2018-10-20 07:18:57 +00:00
*Make sure you have antialiasing off.*
2018-10-20 07:17:33 +00:00
Here are some examples of bad and good colorings:
2018-10-20 07:23:26 +00:00
|Image|Zoom|Comment|
|--- | --- | ---|
|![Incomplete coloring](/readme_images/mermaid_face_censored_bad_incomplete.png)|![Incomplete coloring](/readme_images/mermaid_face_censored_bad_incomplete_zoom.png)|Some censored pixels was left uncolored. Expand your selections to fully cover all censored regions.|
|![Bad edges](/readme_images/mermaid_face_censored_bad_edge.png)|![Bad edges](/readme_images/mermaid_face_censored_bad_edge_zoom.png)|Some pixels around the edges of the green regions are not pure green. This will cause the green to bleed into the decensors. Make sure anti-aliasing is off and to use a pencil tool and not a brush tool if possible.|
2018-10-21 05:39:03 +00:00
|![Perfect coloring!](/readme_images/mermaid_face_censored_good.png)|![Perfect coloring! The censored region is uniformly colored correctly.](/readme_images/mermaid_face_censored_good_zoom.png)|Perfect coloring!|
2018-10-20 07:17:33 +00:00
2018-10-25 22:35:49 +00:00
## FAQ
2018-10-25 22:34:02 +00:00
- Q: Why aren't black and white images supported? Aren't black and white images easier to decensor than color images?
- A: Black and white images are harder to decensor than color images because neural networks struggle to replicate screentone patterns.
2018-10-25 22:35:49 +00:00
## To do
2018-10-30 08:30:27 +00:00
- Finish the user interface (sometime in November)
- Update model with better quality data (sometime in November)
2018-10-25 17:41:13 +00:00
- Add support for black and white images
2018-10-30 08:30:27 +00:00
- Add error log
2018-10-20 04:00:04 +00:00
Contributions are welcome! Special thanks to StartleStars for contributing code for mosaic decensorship and SoftArmpit for greatly simplifying decensoring!
2018-10-25 22:35:49 +00:00
## License
2018-10-29 22:28:51 +00:00
```
2018-10-29 22:27:41 +00:00
# Copyright (c) 2018, deeppomf. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike
# 4.0 International License. To view a copy of this license, visit
# https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
2018-10-29 22:28:51 +00:00
```
2018-10-22 22:39:07 +00:00
See [LICENSE.txt](LICENSE.txt) for information about the license.
2018-10-22 22:25:59 +00:00
2018-10-25 22:35:49 +00:00
## Acknowledgements
2018-10-22 02:30:04 +00:00
Example mermaid image by Shurajo & AVALANCHE Game Studio under [CC BY 3.0 License](https://creativecommons.org/licenses/by/3.0/). The example image is modified from the original, which can be found [here](https://opengameart.org/content/mermaid).
2018-10-20 04:43:56 +00:00
2018-10-22 02:30:04 +00:00
Neural network code is modified from MathiasGruber's project [Partial Convolutions for Image Inpainting using Keras](https://github.com/MathiasGruber/PConv-Keras), which is an unofficial implementation of the paper [Image Inpainting for Irregular Holes Using Partial Convolutions](https://arxiv.org/abs/1804.07723). [Partial Convolutions for Image Inpainting using Keras](https://github.com/MathiasGruber/PConv-Keras) is licensed under the MIT license.
2018-10-20 04:00:04 +00:00
2018-10-22 02:30:04 +00:00
User interface code is modified from Packt's project [Tkinter GUI Application Development Blueprints - Second Edition](https://github.com/PacktPublishing/Tkinter-GUI-Application-Development-Blueprints-Second-Edition). [Tkinter GUI Application Development Blueprints - Second Edition](https://github.com/PacktPublishing/Tkinter-GUI-Application-Development-Blueprints-Second-Edition) is licensed under the MIT license.
2018-10-20 04:00:04 +00:00
2018-10-30 01:04:07 +00:00
Data is modified from gwern's project [Danbooru2017: A Large-Scale Crowdsourced and Tagged Anime Illustration Dataset](https://www.gwern.net/Danbooru2017).
See [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md) for full license text of these projects.
2018-10-28 07:10:58 +00:00
## Donations
If you like the work I do, you can donate to me via Paypal: [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SAM6C6DQRDBAE)