tensorflow / tensorflow/models

how to modify image channel in slim.train_image_classifier.py

Open
#7,554 3 comments 0 reactions 2 assignees View on GitHub

@marksandler2 is already working on this.

Since Jun 22, 2020.

models:research type:support
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

INFO:tensorflow:Restoring parameters from ./train_checkpoint912/model.ckpt-0
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Starting Session.
INFO:tensorflow:Saving checkpoint to path ./train_checkpoint912/model.ckpt
INFO:tensorflow:Starting Queues.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, input must have 3 channels but instead has 1 channels.
[[{{node distort_image/distort_color/adjust_saturation/AdjustSaturation}} = AdjustSaturation[_device="/job:localhost/replica:0/task:0/device:CPU:0"](distort_image/distort_color/ArithmeticOptimizer/AddOpsRewrite_adjust_brightness, distort_image/distort_color/random_uniform_1)]]
2019-09-12 11:24:24.361639: W tensorflow/core/kernels/queue_base.cc:285] _2_prefetch_queue/fifo_queue: Skipping cancelled dequeue attempt with queue not closed
INFO:tensorflow:Caught OutOfRangeError. Stopping Training. FIFOQueue '_2_prefetch_queue/fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
[[node fifo_queue_Dequeue (defined at train_image_classifier.py:469) = QueueDequeueV2component_types=[DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
[[{{node fifo_queue_Dequeue/_619}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_296_fifo_queue_Dequeue", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op 'fifo_queue_Dequeue', defined at:
File "train_image_classifier.py", line 590, in
tf.app.run()
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "train_image_classifier.py", line 487, in main
clones = model_deploy.create_clones(deploy_config, clone_fn, [batch_queue])
File "/home4/jiashuaihe/projects/models-master/research/slim/deployment/model_deploy.py", line 193, in create_clones
outputs = model_fn(*args, **kwargs)
File "train_image_classifier.py", line 469, in clone_fn
images, labels = batch_queue.dequeue()
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/ops/data_flow_ops.py", line 435, in dequeue
self._queue_ref, self._dtypes, name=name)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 3741, in queue_dequeue_v2
timeout_ms=timeout_ms, name=name)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()

OutOfRangeError (see above for traceback): FIFOQueue '_2_prefetch_queue/fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
[[node fifo_queue_Dequeue (defined at train_image_classifier.py:469) = QueueDequeueV2component_types=[DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
[[{{node fifo_queue_Dequeue/_619}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_296_fifo_queue_Dequeue", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

INFO:tensorflow:Finished training! Saving model to disk.
Traceback (most recent call last):
File "train_image_classifier.py", line 590, in
tf.app.run()
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "train_image_classifier.py", line 586, in main
sync_optimizer=optimizer if FLAGS.sync_replicas else None)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/contrib/slim/python/slim/learning.py", line 785, in train
ignore_live_threads=ignore_live_threads)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/training/supervisor.py", line 832, in stop
ignore_live_threads=ignore_live_threads)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 389, in join
six.reraise(*self._exc_info_to_raise)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/training/queue_runner_impl.py", line 257, in _run
enqueue_callable()
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1257, in _single_operation_run
self._call_tf_sessionrun(None, {}, [], target_list, None)
File "/home/jiashuaihe/anaconda2/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: input must have 3 channels but instead has 1 channels.
[[{{node distort_image/distort_color/adjust_saturation/AdjustSaturation}} = AdjustSaturation[_device="/job:localhost/replica:0/task:0/device:CPU:0"](distort_image/distort_color/ArithmeticOptimizer/AddOpsRewrite_adjust_brightness, distort_image/distort_color/random_uniform_1)]]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.