我需要合并RGB和YCRCB通道,作为使用mobilenet_1.0_224模型在tensorflow上重新训练的输入数据。
我在func /tensorflow/examples/image_retraining/retrain.py
中更改了文件get_random_distorted_bottlenecks
:
bottlenecks.append(bottleneck_values)
ground_truths.append(ground_truth)
到
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)
和func create_bottleneck_file
,我插入:
image = cv2.imread(image_path)
image_ycrcb = cv2.cvtColor(image,cv2.COLOR_RGB2YCrCb)
bottlenecks = np.dstack(bottleneck_values, image_ycrcb)
前
bottleneck_string = ','.join(str(x) for x in bottleneck_values)
with open(bottleneck_path, 'w') as bottleneck_file:
bottleneck_file.write(bottleneck_string)
最后,我将“移动网络”输入频道从3
更改为6
。
我认为现在mobilenet-retraining的输入数据通道现在是6.我运行了retrain.py, 然后得到了这个:
InvalidArgumentError(参见上面的追溯):频道必须是0,1,3或4,得到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)§§
我该如何解决?它合法地改变频道超过4?