emilwallner / coloring-greyscale-images Goto Github PK
View Code? Open in Web Editor NEWColoring black and white images with deep learning.
License: MIT License
Coloring black and white images with deep learning.
License: MIT License
"generator() takes 5 positional arguments but 6 were given"
I got this error when i run the colorise_base.py in gan version.How colud i resolve this?
Calling Model.predict
in graph mode is not supported when the Model
instance was constructed with eager mode enabled. Please construct your Model
instance in graph mode or call Model.predict
with eager mode enabled.
Can you help me to fix this problem? I don't know why it occur.
Error :
tensorflow.python.framework.errors_impl.AbortedError: Operation received an exception:Status: 3, message: could not initialize a memory descriptor, in file tensorflow/core/kernels/mkl_concat_op.cc:781
Deatil: :
Using TensorFlow backend.
1.7.0
WARNING:tensorflow:From /root/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Epoch 1/100
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/root/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/root/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun
status, run_metadata)
File "/root/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.AbortedError: Operation received an exception:Status: 3, message: could not initialize a memory descriptor, in file tensorflow/core/kernels/mkl_concat_op.cc:781
[[Node: concatenate_1/concat = _MklConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _kernel="MklOp", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_211/Relu, reshape_1/Reshape, concatenate_1/concat/axis, conv2d_211/Relu:1, reshape_1/Reshape:1, DMT/_19)]]
It says "cannot pickle generator objects"
I get an attribute error, anyone can help? Thanks.
AttributeError Traceback (most recent call last)
<ipython-input-15-218ed4947ab4> in <module>()
1 # Building the neural network
----> 2 model = Sequential()
3 model.add(InputLayer(input_shape=(None, None, 1)))
4 model.add(Conv2D(8, (3, 3), activation='relu', padding='same', strides=2))
5 model.add(Conv2D(8, (3, 3), activation='relu', padding='same'))
/home/x/.local/lib/python3.7/site-packages/keras/engine/sequential.py in __init__(self, layers, name)
85
86 def __init__(self, layers=None, name=None):
---> 87 super(Sequential, self).__init__(name=name)
88 self._build_input_shape = None
89
/home/x/.local/lib/python3.7/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your `' + object_name + '` call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
/home/x/.local/lib/python3.7/site-packages/keras/engine/network.py in __init__(self, *args, **kwargs)
94 else:
95 # Subclassed network
---> 96 self._init_subclassed_network(**kwargs)
97
98 def _base_init(self, name=None):
/home/x/.local/lib/python3.7/site-packages/keras/engine/network.py in _init_subclassed_network(self, name)
292
293 def _init_subclassed_network(self, name=None):
--> 294 self._base_init(name=name)
295 self._is_graph_network = False
296 self._expects_training_arg = has_arg(self.call, 'training')
/home/x/.local/lib/python3.7/site-packages/keras/engine/network.py in _base_init(self, name)
107 if not name:
108 prefix = self.__class__.__name__.lower()
--> 109 name = prefix + '_' + str(K.get_uid(prefix))
110 self.name = name
111
/home/x/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py in get_uid(prefix)
72 """
73 global _GRAPH_UID_DICTS
---> 74 graph = tf.get_default_graph()
75 if graph not in _GRAPH_UID_DICTS:
76 _GRAPH_UID_DICTS[graph] = defaultdict(int)
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'
❯ python3 colorize_base.py
2023-04-27 06:29:09.365372: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-04-27 06:29:09.366651: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-04-27 06:29:09.393429: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-04-27 06:29:09.393722: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-04-27 06:29:09.891580: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "[abridged]/GAN-version/colorize_base.py", line 6, in <module>
from keras.engine.topology import Input
ModuleNotFoundError: No module named 'keras.engine.topology'
Hi! I'm just curious as to why your model uses a shape 1000 long instead of 1001, as in the paper?
where is the “calc_output_and_feature_size.py”in GAN_version?thank you
I tried running your colornet_script.py. Like in your example, i tried running it with the same image as training and test data. It runs smoothly, but the output image is grayscale. What might be the cause for that?
Is there a pre-trained model for this? I want to do transfer learning on my dataset w/o training from scratch.
Traceback (most recent call last):
File "colorize_base.py", line 308, in
write_log(callback_Full, callback_Full_names, d_loss_fake_full + d_loss_real_full, i)
File "/mnt/Coloring-grey-scale-master/GAN-version/lib/data_utils.py", line 85, in write_log
summary = tf.Summary()
AttributeError: module 'tensorflow' has no attribute 'Summary'
I dont know why. I ran colorize_base.py in Pycharm, it works. But when I run it at a GPU service, this problem came out.
May I ask which version of your tensorflow is?
X = np.array(X, dtype=float)
ValueError: setting an array element with a sequence on Line 15
Any reason why this would happen
ValueError: ('Input data in NumpyArrayIterator
should have rank 4. You passed an array with shape', (0,))
env: tensorflow-gpu 1.15.0,keras 2.3.1,cudakit 10.0.130,cudann 7.6.5
when run full version, encountered following problems, try global_variables_initializer, can't resolve:
2020-04-25 20:43:26.316669: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
Traceback (most recent call last):
File "D:/work/py/Coloring-greyscale-images/Full-version/full_version.py", line 112, in
model.fit_generator(image_a_b_gen(batch_size), epochs=1, steps_per_epoch=1)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\engine\training.py", line 1732, in fit_generator
initial_epoch=initial_epoch)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\engine\training_generator.py", line 185, in fit_generator
generator_output = next(output_generator)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\utils\data_utils.py", line 742, in get
six.reraise(*sys.exc_info())
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\six.py", line 703, in reraise
raise value
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\utils\data_utils.py", line 711, in get
inputs = future.get(timeout=30)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\multiprocessing\pool.py", line 657, in get
raise self._value
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\multiprocessing\pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\utils\data_utils.py", line 650, in next_sample
return six.next(_SHARED_SEQUENCES[uid])
File "D:/work/py/Coloring-greyscale-images/Full-version/full_version.py", line 97, in image_a_b_gen
embed = create_inception_embedding(grayscaled_rgb)
File "D:/work/py/Coloring-greyscale-images/Full-version/full_version.py", line 81, in create_inception_embedding
embed = inception.predict(grayscaled_rgb_resized)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\engine\training.py", line 1462, in predict
callbacks=callbacks)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\keras\engine\training_arrays.py", line 324, in predict_loop
batch_outs = f(ins_batch)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\tensorflow_core\python\keras\backend.py", line 3476, in call
run_metadata=self.run_metadata)
File "D:\ProgramData\Anaconda3\envs\tf1_gpu\lib\site-packages\tensorflow_core\python\client\session.py", line 1472, in call
run_metadata_ptr)
tensorflow.python.framework.errors_impl.FailedPreconditionError: 2 root error(s) found.
(0) Failed precondition: Error while reading resource variable batch_normalization_177/beta from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/batch_normalization_177/beta)
[[{{node batch_normalization_177/cond/ReadVariableOp}}]]
[[predictions/Softmax/_7]]
(1) Failed precondition: Error while reading resource variable batch_normalization_177/beta from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/batch_normalization_177/beta)
[[{{node batch_normalization_177/cond/ReadVariableOp}}]]
0 successful operations.
0 derived errors ignored.
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.