Input channels equal to 6 on tensorflow

空扰寡人 提交于 2019-12-24 15:55:52

问题


I need to merge RGB and YCRCB channels, as the input data of retraining on tensorflow with mobilenet_1.0_224 model.

I changed the file /tensorflow/examples/image_retraining/retrain.py , in func get_random_distorted_bottlenecks :

bottlenecks.append(bottleneck_values) 

ground_truths.append(ground_truth)

to

bottlenecks.append(bottleneck_values)
image = cv2.imread(image_path)
image_ycrcb = cv2.cvtColor(image,cv2.COLOR_RGB2YCrCb)
bottlenecks = np.dstack(bottlenecks, image_ycrcb)
ground_truths.append(ground_truth)

and func create_bottleneck_file, i insert :

image = cv2.imread(image_path)
image_ycrcb = cv2.cvtColor(image,cv2.COLOR_RGB2YCrCb)
bottlenecks = np.dstack(bottleneck_values, image_ycrcb)

before

bottleneck_string = ','.join(str(x) for x in bottleneck_values)
with open(bottleneck_path, 'w') as bottleneck_file:
  bottleneck_file.write(bottleneck_string)

At last, i changed the "mobilenet" input channel from 3 to 6.

I thougth that now the channel of input data of mobilenet-retraining now is 6. I run retrain.py, then got this:

InvalidArgumentError (see above for traceback): channels must be 0, 1, 3, or 4, got 6
°°Node: DecodeJpeg_1 = DecodeJpeg°acceptable_fraction=1, channels=6, dct_method="", fancy_upscaling=true, ratio=1, try_recover_truncated=false, _device="/job:localhost/replica:0/task:0/cpu:0"§(_arg_DistortJPGInput_0_0)§§

How can I resolve it? Is it legitimately changing channel more than 4 ?

来源:https://stackoverflow.com/questions/47918235/input-channels-equal-to-6-on-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!