experience-ml / cartoonize Goto Github PK
View Code? Open in Web Editor NEWA demo webapp to convert images and videos into cartoon!
Home Page: https://cartoonize-lkqov62dia-de.a.run.app/
License: Other
A demo webapp to convert images and videos into cartoon!
Home Page: https://cartoonize-lkqov62dia-de.a.run.app/
License: Other
I find that the cuda is needed in this project, but my GPU is from AMD, so can I cartoonize videos( images are ok), or some ways can achieve this indirectly?
I do not see the config.yaml providing this setting so I was wondering where can one change it.
The system cannot find the path specified.
'F:\PongGame\Test\cartoonize\static\uploaded_videos\e0db715a-a588-4442-900a-c4145bcc56ee.mp4': Invalid argument
The system cannot find the path specified.
'F:\PongGame\Test\cartoonize\static\uploaded_videos\e0db715a-a588-4442-900a-c4145bcc56ee_modified.mp4': Invalid argument
Traceback (most recent call last):
File "F:\PongGame\Test\cartoonize\app.py", line 149, in cartoonize
cartoon_video_path = wb_cartoonizer.process_video(modified_video_path, output_frame_rate)
File "./white_box_cartoonizer\cartoonize.py", line 113, in process_video
out.close()
File "C:\Users\Shivam\AppData\Local\Programs\Python\Python37\lib\site-packages\skvideo\io\abstract.py", line 474, in close
if self._proc is None: # pragma: no cover
AttributeError: 'FFmpegWriter' object has no attribute '_proc'
None
127.0.0.1 - - [17/Jan/2021 01:12:57] "POST /cartoonize HTTP/1.1" 200 -
The system cannot find the path specified.
'F:\PongGame\Test\cartoonize\static\uploaded_videos\1ae5112d-a042-4366-8f06-b5d954955c61.mp4': Invalid argument
The system cannot find the path specified.
'F:\PongGame\Test\cartoonize\static\uploaded_videos\1ae5112d-a042-4366-8f06-b5d954955c61_modified.mp4': Invalid argument
Traceback (most recent call last):
File "F:\PongGame\Test\cartoonize\app.py", line 149, in cartoonize
cartoon_video_path = wb_cartoonizer.process_video(modified_video_path, output_frame_rate)
File "./white_box_cartoonizer\cartoonize.py", line 113, in process_video
out.close()
This seem to only happen with video files, whereas the images are working fine.
OS :- Windows 10
Python Version :- 3.7
GPU Enabled :- Yes
Debug :- True
Hi Professor,
Could you please help me with this?
Reproduce step: install it on windows, when cartoonize the video, there is an error as follow;
Best regards,
'D:\Workspace\cartoonize\static\uploaded_videos\22a98314-0571-4b48-93b3-def5f768314a_modified.mp4': Invalid argument
Traceback (most recent call last):
File "app.py", line 149, in cartoonize
cartoon_video_path = wb_cartoonizer.process_video(modified_video_path, output_frame_rate)
File "./white_box_cartoonizer\cartoonize.py", line 113, in process_video
out.close()
File "D:\ProgramData\Anaconda3\lib\site-packages\skvideo\io\abstract.py", line 474, in close
if self._proc is None: # pragma: no cover
AttributeError: 'FFmpegWriter' object has no attribute '_proc'
None
[2021-02-10 23:48:13,763] ERROR in app: Exception on /cartoonize [POST]
Traceback (most recent call last):
File "app.py", line 149, in cartoonize
cartoon_video_path = wb_cartoonizer.process_video(modified_video_path, output_frame_rate)
File "./white_box_cartoonizer\cartoonize.py", line 113, in process_video
out.close()
File "D:\ProgramData\Anaconda3\lib\site-packages\skvideo\io\abstract.py", line 474, in close
if self._proc is None: # pragma: no cover
AttributeError: 'FFmpegWriter' object has no attribute '_proc'
Hi,
No bug here, i was just asking myself why you used the slim api for Conv2d layers?
thx
raise ModelError(prediction.error)
replicate.exceptions.ModelError: Variable generator/Conv/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?
Can I modify the model so that the generated video is more like a Japanese cartoon?
Tried installing dependencies, got this error "ERROR: No matching distribution found for tensorflow==2.1.0 (from -r requirements.txt (line 5))"
Can you confirm that this is the right version of TensorFlow used
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
I am experimenting it on Arch and I get this:
[2022-02-22 22:52:25 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2022-02-22 22:52:25 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2022-02-22 22:52:25 +0000] [1] [INFO] Using worker: threads
[2022-02-22 22:52:25 +0000] [9] [INFO] Booting worker with pid: 9
[2022-02-22 22:52:26 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/app.py", line 14, in <module>
from flask import Flask, render_template, make_response, flash
File "/usr/local/lib/python3.7/site-packages/flask/__init__.py", line 21, in <module>
from .app import Flask, Request, Response
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 25, in <module>
from . import cli, json
File "/usr/local/lib/python3.7/site-packages/flask/json/__init__.py", line 21, in <module>
from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.7/site-packages/itsdangerous/__init__.py)
[2022-02-22 22:52:26 +0000] [9] [INFO] Worker exiting (pid: 9)
[2022-02-22 22:52:26 +0000] [1] [INFO] Shutting down: Master
[2022-02-22 22:52:26 +0000] [1] [INFO] Reason: Worker failed to boot.
Any clue how to fix it? Cheers!
Now ngrok asks for auth token. I made my own but I don't know how to set it up in Google's Collab.
Thanks.
Getting ngrok authentication error after clicking * Running on http://8834-34-90-0-63.ngrok.io/
Tried to add authentication but failed. Pls help.
Hi,
I was trying to run and check the code Google Colab and getting the error as below.
File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
Please check this issue on the link.
https://colab.research.google.com/drive/1tldmcOlzwbzjG3YGH5LPZGGvEytnZwBR?usp=sharing
I see this output:
2022-02-23 01:08:39.308680: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] no NVIDIA GPU device is present: /dev/nvidia0 does not exist
But my Nvidia is installed and works well. How to debug?
I have set to use the GPU in the yaml file btw.
[2023-10-10 12:43:22 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2023-10-10 12:43:22 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2023-10-10 12:43:22 +0000] [1] [INFO] Using worker: threads
[2023-10-10 12:43:22 +0000] [9] [INFO] Booting worker with pid: 9
[2023-10-10 12:43:24 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/app/app.py", line 13, in
from flask import Flask, render_template, make_response, flash
File "/usr/local/lib/python3.7/site-packages/flask/init.py", line 19, in
from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/usr/local/lib/python3.7/site-packages/jinja2/init.py)
[2023-10-10 12:43:24 +0000] [9] [INFO] Worker exiting (pid: 9)
[2023-10-10 12:43:24 +0000] [1] [INFO] Shutting down: Master
[2023-10-10 12:43:24 +0000] [1] [INFO] Reason: Worker failed to boot.
I have gone through your code. It's working well for cartoonization of images. I have taken input as a transparent background image and need output also with transparent background cartoonized image.
Now I am getting white background images. How can I achieve this? Please guide me ASAP.
Thanks in Advance
Hima Bindu Y
NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array
For me, the above issue occurred when upgrading from numpy 1.20 and using ray's RLlib, which uses tensorflow 2.2 internally. Simply downgrading with version numpy==1.19.5 solved my problem.
Can we upload a video with more than 30 MB?
cannot import name 'Markup' from 'jinja2'
layer.__call__
method instead.First thing's first. What a wonderful app. Is it without a doubt prohibited to use the output of the demo web app in for example a graphic novel that you intend to sell (commercial use).
Best regards.
configure info : config.yaml
---
run_local: true #Set this to true if you are running locally, false if you have configured the Google buckets and algorithmia code.
gpu: true #Set this to true if you want to use the GPU
trim-video: false #Set this to false if you want to process full video
trim-video-length: 3600 #Max number of seconds you want to trim the video from start
original_frame_rate: false #If False output_frame_rate will be used else original video detected frame rate will be used, if no metadata found will use output_frame_rate
output_frame_rate: '24/1' #Set the output frame rate, if original resolution
colab-mode: true #Set true if you are executing in colab mode
original_resolution: true # Set to true if you don't want to resize the original video
resize-dim: 720 #The width of the video will be resized to specified number maintaining aspect ratio
modify templates/index_cartoonized.html check max_file_size
const fsize = fi.files.item(i).size;
const file = Math.round((fsize / 1024));
// The size of the file.
//Change the max_file_size as per your need
const max_file_size = 33330720;
error info:
ov/2021 13:22:07] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/emma2.jpg HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/emma2_cartoonized.jpg HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/spice.jpeg HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/cake.jpeg HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/spice_cartoonized.jpeg HTTP/1.1" 200 -
127.0.0.1 - - [08/Nov/2021 13:22:09] "GET /static/sample_images/cake_cartoonized.jpeg HTTP/1.1" 200 -
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 131, in wrapper
return f(self, stream, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 253, in _parse_multipart
form, files = parser.parse(stream, boundary, content_length)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 584, in parse
return self.cls(form), self.cls(files)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/datastructures.py", line 419, in __init__
for key, value in mapping or ():
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 582, in <genexpr>
form = (p[1] for p in formstream if p[0] == "form")
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 537, in parse_parts
for ellt, ell in self.parse_lines(file, boundary, content_length):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 480, in parse_lines
for line in iterator:
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 761, in make_line_iter
for item in _iter_basic_lines():
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 737, in _iter_basic_lines
new_data = next(_iter, "")
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 681, in _make_chunk_iter
item = _read(buffer_size)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 943, in read
return self.on_disconnect()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 911, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 73, in cartoonize
if flask.request.files.get('image'):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/utils.py", line 90, in __get__
value = self.func(obj)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wrappers/base_request.py", line 514, in files
self._load_form_data()
File "/usr/local/lib/python3.7/dist-packages/flask/wrappers.py", line 168, in _load_form_data
RequestBase._load_form_data(self)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wrappers/base_request.py", line 319, in _load_form_data
self._get_stream_for_parsing(), mimetype, content_length, options
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 232, in parse
return parse_func(self, stream, mimetype, content_length, options)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 135, in wrapper
exhaust()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 925, in exhaust
self.read(chunk)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 943, in read
return self.on_disconnect()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 911, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
None
[2021-11-08 13:27:16,006] ERROR in app: Exception on /cartoonize [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 131, in wrapper
return f(self, stream, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 253, in _parse_multipart
form, files = parser.parse(stream, boundary, content_length)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 584, in parse
return self.cls(form), self.cls(files)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/datastructures.py", line 419, in __init__
for key, value in mapping or ():
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 582, in <genexpr>
form = (p[1] for p in formstream if p[0] == "form")
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 537, in parse_parts
for ellt, ell in self.parse_lines(file, boundary, content_length):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 480, in parse_lines
for line in iterator:
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 761, in make_line_iter
for item in _iter_basic_lines():
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 737, in _iter_basic_lines
new_data = next(_iter, "")
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 681, in _make_chunk_iter
item = _read(buffer_size)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 943, in read
return self.on_disconnect()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 911, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 73, in cartoonize
if flask.request.files.get('image'):
File "/usr/local/lib/python3.7/dist-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/utils.py", line 90, in __get__
value = self.func(obj)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wrappers/base_request.py", line 514, in files
self._load_form_data()
File "/usr/local/lib/python3.7/dist-packages/flask/wrappers.py", line 168, in _load_form_data
RequestBase._load_form_data(self)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wrappers/base_request.py", line 319, in _load_form_data
self._get_stream_for_parsing(), mimetype, content_length, options
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 232, in parse
return parse_func(self, stream, mimetype, content_length, options)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/formparser.py", line 135, in wrapper
exhaust()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 925, in exhaust
self.read(chunk)
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 943, in read
return self.on_disconnect()
File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 911, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "app.py", line 168, in cartoonize
flash("Our server hiccuped :/ Please upload another file! :)")
File "/usr/local/lib/python3.7/dist-packages/flask/helpers.py", line 410, in flash
session['_flashes'] = flashes
File "/usr/local/lib/python3.7/dist-packages/werkzeug/local.py", line 350, in __setitem__
self._get_current_object()[key] = value
File "/usr/local/lib/python3.7/dist-packages/flask/sessions.py", line 101, in _fail
raise RuntimeError('The session is unavailable because no secret '
RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
127.0.0.1 - - [08/Nov/2021 13:27:16] "POST /cartoonize HTTP/1.1" 500 -
Can't Process Full Video changing the code in app.py to:
os.system("ffmpeg -hide_banner -loglevel warning -ss 0 -i '{}' -filter:v scale={}:-2 -r 15 -c:a copy '{}'".format(os.path.abspath(original_video_path), width_resize, os.path.abspath(modified_video_path)))
what else I need to do?
THANKS FROM COLOMBIA!!!
when i upload a fake .jpg to your website it show this message , how can i get the same effect?
my website shows
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.