Code Monkey home page Code Monkey logo

tsuki's Introduction

Tsuki

Manga/picture uncensoring script based on

Demo

Right now the program only works with bar censoring, mosaic and video uncensoring will be implemented later

Google colab version

If you want to use the google colab version, make a copy of this in your own google drive and download the models from the section below

Installiation

System requirements

  • CUDA Compatible GPU
  • CUDA (latest version) (current working one is 11.5)
  • CUDNN (latest version compatible with CUDA) (current working one is 8.3.2)
  • Python 3.9.7

Notes

  • If you have others CUDA version installed, make sure you set the system variable "CUDA_PATH" to your latest CUDA path
  • Make sure you install CUDNN with the zip not the exe
  • If you doesn't have GPU that can support CUDA you can run the script with CPU capable of running tensorflow as well

Automatic installation

.\init.bat

Manual installation (Not recommended)

cd tsuki
cd modules
virtualenv env --python=3.9.7
pip install -r requirements.txt
  • Create "input" and "output" folder in Converter folder

  • Ceate "decensor_input" and "decensor_output" folder in DeepCreamPy folder

  • Create "input" and "output" folder in HentAI folder

  • Create "input" and "output" folder in the ToneRemover folder

Download the models

DeepCreamPy

  • Models.zip
    • Extract the file then put it in DeepCreamPy/models folder

HentAI

Usage (Automatic)

If you ran "init.bat" already, there should be "INPUT" and "OUTPUT" folder at the root of the project

For black & white manga/picture

Put the images in "INPUT" folder (Both PNG & JPG are acceptable)

.\run-blackwhite.bat

For colored manga/picture

Put the images in "INPUT" folder (Both PNG & JPG are acceptable)

.\run-color.bat

Usage (Manual)

Make sure you are using the correct environment when using each modules

  1. Activate HentAI environment then put the image in the "png" format into the "input" folder you just created
  2. Move the result from "output" folder from HentAI to "decensor_input" in DeepCreamPy folder
  3. Run DeepCreamPy and done! you have your uncensored image

tsuki's People

Contributors

dependabot[bot] avatar gusb3ll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tsuki's Issues

hent-AI bar_detect, DeepCreamPydecensor and memory error *SOLVED*

Howdy, while trying to run the script, I get this traceback for hent-AI detection and eventually a memory error with DCP.

Running CUDA 11.5 and Python 3.9.7 as suggested and the latest cuDNN. (Here's the problem! 8.7 does not work, for those having this issue, use the specific version of CUDA, Python, and cuDNN detailed in README.md! Figured this out after a test I wanted to try before posting this.)

Traceback (most recent call last):
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\main.py", line 76, in
bar_detect()
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\main.py", line 72, in bar_detect
hentAI_detection(dcp_dir=d_entry, in_path=o_entry, is_mosaic=False, is_video=False, force_jpg=True, dilation=int(dil_entry))
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\main.py", line 63, in hentAI_detection
detect_instance.run_on_folder(input_folder=in_path, output_folder=dcp_dir + '/', is_video=False, is_mosaic=is_mosaic, dilation=dilation)
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\detector.py", line 573, in run_on_folder
self.detect_and_cover(img_path, img_name, output_folder, is_mosaic=is_mosaic, dilation=dilation) #sending force_jpg for debugging
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\detector.py", line 519, in detect_and_cover
cov, mask = self.apply_cover(image, new_masks, dilation)
File "D:\Decensoring\Tsuki1.2\Modules\HentAI\detector.py", line 120, in apply_cover
green = np.zeros([image.shape[0], image.shape[1], image.shape[2]], dtype=np.uint8)
numpy.core._exceptions.MemoryError: Unable to allocate 74.7 MiB for an array with shape (6072, 4300, 3) and data type uint8
A duplicate file name exists, or the file
cannot be found.
D:\Decensoring\Tsuki1.2\Modules\HentAI\input*, Are you sure (Y/N)? y
←[90m[10:38:55AM] ←[36m----- DeepCreamPy modified by Gusbell -----←[0m
D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\keras\engine\base_layer_v1.py:1694: UserWarning: layer.apply is deprecated and will be removed in a future version. Please use layer.__call__ method instead.
warnings.warn('layer.apply is deprecated and '
Traceback (most recent call last):
File "D:\Decensoring\Tsuki1.2\Modules\DeepCreamPy\decensor.py", line 156, in
decensor = Decensor()
File "D:\Decensoring\Tsuki1.2\Modules\DeepCreamPy\decensor.py", line 22, in init
self.load_model()
File "D:\Decensoring\Tsuki1.2\Modules\DeepCreamPy\decensor.py", line 31, in load_model
self.model = InpaintNN(bar_model_name="./models/bar/Train_775000.meta", bar_checkpoint_name="./models/bar/", mosaic_model_name="./models/mosaic/Train_290000.meta", mosaic_checkpoint_name="./models/mosaic/", is_mosaic=self.is_mosaic)
File "D:\Decensoring\Tsuki1.2\Modules\DeepCreamPy\model.py", line 22, in init
self.build_model()
File "D:\Decensoring\Tsuki1.2\Modules\DeepCreamPy\model.py", line 89, in build_model
Restore.restore(self.sess, tf.train.latest_checkpoint(self.bar_checkpoint_name))
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\training\saver.py", line 1400, in restore
sess.run(self.saver_def.restore_op_name,
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 967, in run
result = self._run(None, fetches, feed_dict, options_ptr,
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 1190, in _run
results = self._do_run(handle, final_targets, final_fetches,
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_run
return self._do_call(_run_fn, feeds, fetches, targets, options,
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 1377, in _do_call
return fn(*args)
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 1359, in _run_fn
self._extend_graph()
File "D:\Decensoring\Tsuki1.2\Modules\env\lib\site-packages\tensorflow\python\client\session.py", line 1400, in _extend_graph
tf_session.ExtendSession(self._session)
MemoryError: bad allocation
A duplicate file name exists, or the file
cannot be found.
D:\Decensoring\Tsuki1.2\modules\DeepCreamPy\decensor_input*, Are you sure (Y/N)? y

DECENSORING COMPETED, ENJOY!

Full rewrite

Planning on full rewrite on the repos for more easy intergration & migrate all deps to tensorflow 2

DeepCreamPy fails

Hi. I believe i've set up all the necessary pre-requisites and loaded up the indicated models, but the process doesn't seem to work. I get the following error during DeepCreamPy.

[08:34:27PM] ----- DeepCreamPy modified by Gusbell -----
C:\Users\Kuro\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\keras\engine\base_layer_v1.py:1694: UserWarning: `layer.apply` is deprecated and will be removed in a future version. Please use `layer.__call__` method instead.
  warnings.warn('`layer.apply` is deprecated and '
Traceback (most recent call last):
  File "C:\Users\Kuro\Downloads\DLs\Tsuki_1.2.0-hotfix\Tsuki-main\Modules\DeepCreamPy\decensor.py", line 156, in <module>
    decensor = Decensor()
  File "C:\Users\Kuro\Downloads\DLs\Tsuki_1.2.0-hotfix\Tsuki-main\Modules\DeepCreamPy\decensor.py", line 22, in __init__
    self.load_model()
  File "C:\Users\Kuro\Downloads\DLs\Tsuki_1.2.0-hotfix\Tsuki-main\Modules\DeepCreamPy\decensor.py", line 31, in load_model
    self.model = InpaintNN(bar_model_name="./models/bar/Train_775000.meta", bar_checkpoint_name="./models/bar/", mosaic_model_name="./models/mosaic/Train_290000.meta", mosaic_checkpoint_name="./models/mosaic/", is_mosaic=self.is_mosaic)
  File "C:\Users\Kuro\Downloads\DLs\Tsuki_1.2.0-hotfix\Tsuki-main\Modules\DeepCreamPy\model.py", line 22, in __init__
    self.build_model()
  File "C:\Users\Kuro\Downloads\DLs\Tsuki_1.2.0-hotfix\Tsuki-main\Modules\DeepCreamPy\model.py", line 88, in build_model
    Restore = tf.compat.v1.train.import_meta_graph(self.bar_model_name)
  File "C:\Users\Kuro\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\training\saver.py", line 1565, in import_meta_graph
    return _import_meta_graph_with_return_elements(meta_graph_or_file,
  File "C:\Users\Kuro\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\training\saver.py", line 1581, in _import_meta_graph_with_return_elements
    meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file)
  File "C:\Users\Kuro\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\framework\meta_graph.py", line 634, in read_meta_graph_file
    raise IOError("File does not exist. Received: {filename}.")
OSError: File does not exist. Received: {filename}.

Any idea what's wrong?

Some model links offline

Both the DeepCreamPy and the first HentAI models seem to be offline. Is it possible they could be reuploaded?

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.