我正在關注Colab 的本教程 ( https://colab.research.google.com/github/khanhlvg/tflite_raspberry_pi/blob/main/object_detection/Train_custom_model_tutorial.ipynb ) 并在我自己的 Windows 機器上運行它。
當我除錯我的腳本時,它會拋出這個錯誤>
The size of the train_data (0) couldn't be smaller than batch_size (4). To solve this problem, set the batch_size smaller or increase the size of the train_data.
在我的代碼片段上
model = object_detector.create(train_data, model_spec=spec, batch_size=4, train_whole_model=True, epochs=20, validation_data=val_data)
我自己的訓練資料包含 101 張影像,而 Colab 的示例在其訓練檔案夾中僅包含 62 張。
我知道它抱怨訓練資料不能小于批量大小,但我不明白為什么它首先拋出它,因為我的訓練資料不是空的。
在我自己的機器上,我有 Tensorflow 版本:2.8.0,就像在 colab 中一樣。
我嘗試將批量大小從 0 增加到 100plus,但仍然給我同樣的錯誤。
我嘗試洗掉一個樣本,因此有 100 個影像并將樣本大小設定為 2 、 4 等......但仍然拋出錯誤。
我得出的結論是它沒有正確加載資料,但為什么?
uj5u.com熱心網友回復:
對于遇到與我相同的問題的任何人,這是我的解決方案。
好的,發生這種情況的原因是因為 Python 的不同版本。
我試圖用 Python 3.8.10 在本地運行它
Colab 正在運行 3.7.12 。
我使用版本 (3.7.12) 在 colab 上運行了我的所有資料,并訓練了我的模型,沒有更多問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/434154.html
上一篇:覆寫每個時期的情節
