问题
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