i have selected some training images from ade20k dataset with their color codded _seg.png mask images
i set certain parameters at first as the train.py
INPUT_SIZE = '473,473' #"Comma-separated string with height and width of images."
LEARNING_RATE = 1e-3 #"Base learning rate for training with polynomial decay."
MOMENTUM = 0.9 #"Momentum component of the optimiser."
NUM_CLASSES = 150 #"Number of classes to predict (including background)."
NUM_STEPS = 60001 #"Number of training steps."
POWER = 0.9 #"Decay parameter to compute the learning rate."
RANDOM_SEED = 1234 #"Random seed to have reproducible results."
WEIGHT_DECAY = 0.0001 #"Regularisation parameter for L2-loss."
RESTORE_FROM = './model/ade20k/x/' #"Where restore model parameters from."
SNAPSHOT_DIR = './model/ade20k/x/' #"Where to save snapshots of the model."
SAVE_NUM_IMAGES = 4 #"How many images to save."
SAVE_PRED_EVERY = 50 #"Save summaries and checkpoint every often."
tf.reset_default_graph()
but when i tried training code on them they give me the following error.
INFO:tensorflow:Restoring parameters from ./model/ade20k/x/model.ckpt-0
Restored model parameters from ./model/ade20k/x/model.ckpt-0
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.ResourceExhaustedError'>, OOM when allocating tensor with shape[1333,2000,3] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: create_inputs/Cast = Cast[DstT=DT_FLOAT, SrcT=DT_UINT8, _device="/job:localhost/replica:0/task:0/device:GPU:0"](create_inputs/concat)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
Traceback (most recent call last):
File "<ipython-input-7-78358ffb08d0>", line 1, in <module>
runfile('D:/mobileNetPSPNet/tuning.py', wdir='D:/mobileNetPSPNet')
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/mobileNetPSPNet/tuning.py", line 176, in <module>
main()
File "D:/mobileNetPSPNet/tuning.py", line 165, in main
loss_value, _ = sess.run([reduced_loss, train_op], feed_dict=feed_dict)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
ResourceExhaustedError: OOM when allocating tensor with shape[3,3,256,256] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: gradients/L2Loss_31_grad/mul = Mul[T=DT_FLOAT, _class=["loc:@gradients/AddN_37"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](conv4_2_3x3/weights/read, mul/x)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
[[Node: conv4_3_3x3/weights/read/_741 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_321_conv4_3_3x3/weights/read", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
Caused by op 'gradients/L2Loss_31_grad/mul', defined at:
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 223, in <module>
main()
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 219, in main
kernel.start()
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 474, in start
ioloop.IOLoop.instance().start()
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\zmq\eventloop\ioloop.py", line 162, in start
super(ZMQIOLoop, self).start()
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\tornado\ioloop.py", line 887, in start
handler_func(fd_obj, events)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\tornado\stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\tornado\stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 276, in dispatcher
return self.dispatch_shell(stream, msg)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 228, in dispatch_shell
handler(stream, idents, msg)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 390, in execute_request
user_expressions, allow_stdin)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 501, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-7-78358ffb08d0>", line 1, in <module>
runfile('D:/mobileNetPSPNet/tuning.py', wdir='D:/mobileNetPSPNet')
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/mobileNetPSPNet/tuning.py", line 176, in <module>
main()
File "D:/mobileNetPSPNet/tuning.py", line 125, in main
grads = tf.gradients(reduced_loss, conv_trainable + fc_w_trainable + fc_b_trainable)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 532, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 701, in _GradientsHelper
lambda: grad_fn(op, *out_grads))
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 396, in _MaybeCompile
return grad_fn() # Exit early
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 701, in <lambda>
lambda: grad_fn(op, *out_grads))
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\nn_grad.py", line 963, in _L2LossGrad
return op.inputs[0] * grad
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\math_ops.py", line 847, in binary_op_wrapper
return func(x, y, name=name)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\math_ops.py", line 1091, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 5066, in mul
"Mul", x=x, y=y, name=name)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
...which was originally created as op 'L2Loss_31', defined at:
File "C:\Users\BioHelwan\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 223, in <module>
main()
[elided 20 identical lines from previous traceback]
File "D:/mobileNetPSPNet/tuning.py", line 176, in <module>
main()
File "D:/mobileNetPSPNet/tuning.py", line 106, in main
l2_losses = [WEIGHT_DECAY * tf.nn.l2_loss(v) for v in tf.trainable_variables() if 'weights' in v.name]
File "D:/mobileNetPSPNet/tuning.py", line 106, in <listcomp>
l2_losses = [WEIGHT_DECAY * tf.nn.l2_loss(v) for v in tf.trainable_variables() if 'weights' in v.name]
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 4715, in l2_loss
"L2Loss", t=t, name=name)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\Users\BioHelwan\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[3,3,256,256] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: gradients/L2Loss_31_grad/mul = Mul[T=DT_FLOAT, _class=["loc:@gradients/AddN_37"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](conv4_2_3x3/weights/read, mul/x)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
[[Node: conv4_3_3x3/weights/read/_741 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_321_conv4_3_3x3/weights/read", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
how can i get rid of this error?
and how can the train be done on the colored masks of ade20k dataset not gray masks?
Thanks