问题描述
我使用TFF 0.12.0
每个客户在训练中有38张图像,在测试中有16张图像,我有4个客户,
.....
def create_compiled_keras_model():
base_model = tf.keras.applications.resnet.resnet50(include_top=False,weights='imagenet',input_shape=(224,224,3,))
global_average_layer = tf.keras.layers.GlobalAveragePooling2D()
prediction_layer = tf.keras.layers.Dense(2,activation='softmax')
model = tf.keras.Sequential([
base_model,global_average_layer,prediction_layer
])
return model
def model_fn():
keras_model = create_compiled_keras_model()
return tff.learning.from_keras_model(keras_model,sample_batch,loss=tf.keras.losses.CategoricalCrossentropy(),metrics=[tf.keras.metrics.CategoricalAccuracy()])
iterative_process = tff.learning.build_federated_averaging_process(model_fn,server_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=1.0),client_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=0.001),client_weight_fn=None)
state = iterative_process.initialize()
我不明白为什么要在执行中找到这些行:
2020-11-05 15:00:16.642666: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 32 in the outer inference context.
2020-11-05 15:00:16.642724: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 23 in the outer inference context.
2020-11-05 15:00:16.643344: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 51 in the outer inference context.
2020-11-05 15:00:16.643400: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 41 in the outer inference context.
2020-11-05 15:00:16.643545: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 69 in the outer inference context.
2020-11-05 15:00:16.643589: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 60 in the outer inference context.
2020-11-05 15:00:16.643696: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 97 in the outer inference context.
2020-11-05 15:00:16.643756: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 86 in the outer inference context.
2020-11-05 15:00:16.643923: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 106 in the outer inference context.
2020-11-05 15:00:16.643988: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 116 in the outer inference context.
2020-11-05 15:00:16.644071: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 79 in the outer inference context.
2020-11-05 15:00:16.644213: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 134 in the outer inference context.
知道如果我用VGG16更改resnet50,这些行将消失。 请帮忙 !!这是什么意思?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)