有人知道这个错误的原因吗?
WARNING:tensorflow:No training configuration found in the save file, so the model was *not* compiled. Compile it manually.
WARNING:tensorflow:11 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x000001F9D1C05EE0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has …Run Code Online (Sandbox Code Playgroud) 因此,对于每个 for 循环,我生成一个图像并要求用户输入“是”或“否”。我希望在生成新图像和新用户输入行之前从单元格中清除图像和用户输入行。相反,只有图像被清除/替换(用户输入行根本不显示)。
这就是现在的样子(for 循环下的所有内容都应该向右缩进):

for filename in os.listdir(folder):
clear_output(wait=True)
split_filename=os.path.splitext(filename)[0] #splitting filename from .jpg
image_id, age=split_filename.split('_', 2) #saving image_id and age
#print([image_id, age])
if int(image_id)>= starting_image_id: #start at a certain image #, specified above
image_ids.append(image_id)
ages.append(age)
#This line below displays image in original color:
#display.display(Image.open(os.path.join(folder,filename)))
#These 5 lines below display image in grayscale:
image = cv2.imread(os.path.join(folder,filename))
image1 = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
plt.figure() # create a new figure
plt.imshow(image1, cmap='gray')
plt.show()
attractive_rating=0 #so that while loop will run until user input …Run Code Online (Sandbox Code Playgroud)