Found 3400 files belonging to 2 classes.
Using 2720 files for training.
Found 3400 files belonging to 2 classes.
Using 680 files for validation.
['cat', 'dog']
for image_batch, labels_batch in train_ds:print(image_batch.shape)print(labels_batch.shape)break
#可视化数据
plt.figure(figsize=(15,10))# 图形的宽为15高为10for images, labels in train_ds.take(1):for i inrange(8):ax = plt.subplot(5,8, i +1)plt.imshow(images[i])plt.title(class_names[labels[i]])plt.axis("off")
Epoch 1/10: 7%| | 3/43 [00:58<12:50, 19.26s/it, train_loss=817908992.0000, train_acc=0.4844, lr=0.WARNING:tensorflow:5 out of the last 5 calls to <function TensorFlowTrainer.make_train_function.<locals>.one_step_on_iterator at 0x0000026D58AB2670> 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 reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.Epoch 1/10: 9%| | 4/43 [01:17<12:21, 19.02s/it, train_loss=33623308288.0000, train_acc=0.4844, lr=WARNING:tensorflow:6 out of the last 6 calls to <function TensorFlowTrainer.make_train_function.<locals>.one_step_on_iterator at 0x0000026D58AB2670> 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 reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.Epoch 1/10: 100%|█| 43/43 [13:22<00:00, 18.66s/it, train_loss=3165756416.0000, train_acc=0.4989, lr=开始验证!Epoch 1/10: 36%|███▋ | 4/11 [00:19<00:34, 4.88s/it, val_loss=2893433856.0000, val_acc=0.4940]WARNING:tensorflow:5 out of the last 5 calls to <function TensorFlowTrainer.make_test_function.<locals>.one_step_on_iterator at 0x0000026DDF2E49D0> 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 reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.Epoch 1/10: 45%|████▌ | 5/11 [00:24<00:29, 4.87s/it, val_loss=2832519680.0000, val_acc=0.4951]WARNING:tensorflow:6 out of the last 6 calls to <function TensorFlowTrainer.make_test_function.<locals>.one_step_on_iterator at 0x0000026DDF2E49D0> 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 reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.Epoch 1/10: 100%|█████████| 11/11 [00:51<00:00, 4.70s/it, val_loss=2532606720.0000, val_acc=0.4974]结束验证!
验证loss为:2787614720.0000
验证准确率为:0.4958Epoch 2/10: 100%|█| 43/43 [13:03<00:00, 18.23s/it, train_loss=1423662976.0000, train_acc=0.5020, lr=开始验证!Epoch 2/10: 100%|█████████| 11/11 [00:52<00:00, 4.74s/it, val_loss=1281297920.0000, val_acc=0.5026]结束验证!
验证loss为:1341318784.0000
验证准确率为:0.5034Epoch 3/10: 100%|█| 43/43 [13:02<00:00, 18.19s/it, train_loss=915221888.0000, train_acc=0.5022, lr=0开始验证!Epoch 3/10: 100%|██████████| 11/11 [00:52<00:00, 4.75s/it, val_loss=854207104.0000, val_acc=0.5026]结束验证!
验证loss为:880286656.0000
验证准确率为:0.5031Epoch 4/10: 100%|█| 43/43 [13:04<00:00, 18.24s/it, train_loss=674374464.0000, train_acc=0.5006, lr=0开始验证!Epoch 4/10: 100%|██████████| 11/11 [00:51<00:00, 4.71s/it, val_loss=640655744.0000, val_acc=0.5001]结束验证!
验证loss为:655163968.0000
验证准确率为:0.4998Epoch 5/10: 100%|█| 43/43 [13:01<00:00, 18.18s/it, train_loss=533879808.0000, train_acc=0.5004, lr=0开始验证!Epoch 5/10: 100%|██████████| 11/11 [00:52<00:00, 4.76s/it, val_loss=512524608.0000, val_acc=0.5007]结束验证!
验证loss为:521749024.0000
验证准确率为:0.5010Epoch 6/10: 100%|█| 43/43 [13:05<00:00, 18.28s/it, train_loss=441831552.0000, train_acc=0.4995, lr=0开始验证!Epoch 6/10: 100%|██████████| 11/11 [00:52<00:00, 4.75s/it, val_loss=427103840.0000, val_acc=0.4992]结束验证!
验证loss为:433481824.0000
验证准确率为:0.4990Epoch 7/10: 100%|█| 43/43 [13:07<00:00, 18.30s/it, train_loss=376856320.0000, train_acc=0.5020, lr=0开始验证!Epoch 7/10: 100%|██████████| 11/11 [00:51<00:00, 4.69s/it, val_loss=366089024.0000, val_acc=0.5022]结束验证!
验证loss为:370760384.0000
验证准确率为:0.5024Epoch 8/10: 100%|█| 43/43 [13:00<00:00, 18.16s/it, train_loss=328541408.0000, train_acc=0.5014, lr=0开始验证!Epoch 8/10: 100%|██████████| 11/11 [00:52<00:00, 4.74s/it, val_loss=320327872.0000, val_acc=0.5015]结束验证!
验证loss为:323896160.0000
验证准确率为:0.5017Epoch 9/10: 100%|█| 43/43 [13:07<00:00, 18.30s/it, train_loss=291207168.0000, train_acc=0.5030, lr=0开始验证!Epoch 9/10: 100%|██████████| 11/11 [00:52<00:00, 4.74s/it, val_loss=284735904.0000, val_acc=0.5027]结束验证!
验证loss为:287550240.0000
验证准确率为:0.5026Epoch 10/10: 100%|█| 43/43 [13:03<00:00, 18.21s/it, train_loss=261492144.0000, train_acc=0.5038, lr=开始验证!Epoch 10/10: 100%|█████████| 11/11 [00:52<00:00, 4.75s/it, val_loss=256262304.0000, val_acc=0.5039]结束验证!
验证loss为:258538656.0000
验证准确率为:0.5041